started at . submit by
hello! please produce the golomb sequence. submissions may be written in any language.
the Golomb sequence (OEIS A001462) is a sequence where each element tells you how many times its index occurs in the sequence. like most integer sequences, the first element is 1. this means the number "1" occurs once in this sequence. the second element, since the number "1" occurs once, cannot be 1, as 1 is already the first element. it is instead the smallest positive integer succeeding 1, which I hear is "2". since this means "2" occurs twice in this sequence, the third element can also be "2", meaning that two elements are the number "3". following in this manner (taking the smallest integer that still satisfies all requirements so far) gives you a monotonically nondecreasing sequence with steps of 1: the Golomb sequence.
your challenge is simply to generate this sequence. as any language is allowed, there is no fixed API.
3 entries have been received so far.