OFFSET
1,2
COMMENTS
In the concatenation of all terms of this sequence, "12032245620...", consider the digits '2' as delimiters of chunks of other digits, "1", "03", "", "456", .... The lengths of these chunks are given by the terms of the sequence. At any point, the next term is the smallest number not occurring earlier and not leading to a contradiction.
LINKS
Eric Angelini, To reach the next "1", SeqFan list, August 10, 2015.
EXAMPLE
The sequence starts with a(1) = 1 digits different from '2'. (It cannot start with a(1) = 0 since this would require to start with a chunk of 0 digits different from '2', i.e., with a digit '2': contradiction.)
Then, the first '2' which occurs as a(2) = 2, must be followed by a(2) = 2 digits different from '2', and the smallest possible choices are a(3) = 0 and a(4) = 3.
The following digit '2', first digit of a(5), must immediately be followed by another digit '2' (because of a(3) = 0), thus a(5) = 22. (Since 2 already occurred earlier, a(5) = 2 followed by a(6) = 20 is not possible. The choice a(4) = 12 would be possible but lead to a lexicographically larger sequence, since they are compared term-wise and not digit-wise.)
Then follow a(4) = 3 other digits before the next '2' in a(9), etc.
PROG
(PARI) A261162(n=99, d=2, a=1, p=0, u=[-1], r=u)={for(n=2, n, print1(a", "); p+=#digits(a)+!a; r=concat(r, r[#r]+a+1); while(#r>1&&r[1]<p, r=r[2..-1]); u=setunion(u, [a]); while(#u>1&&u[2]==u[1]+1, u=u[2..-1]); for(k=u[1]+1, 9e9, setsearch(u, k)&&next; if(r[1] >= p+#dk=if(k, digits(k), [0]), setsearch(Set(dk), d)&&next, for(i=1, #dk, (dk[i]==d)==!setsearch(r, p+i-1)&&next(2))); a=k; next(2)); error); a}
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini and M. F. Hasler, Aug 10 2015
STATUS
approved