login
List run lengths of digits different from '1'. Lexicographically first such sequence of nonnegative numbers with no repeated terms.
8

%I #18 Jan 02 2023 12:30:51

%S 2,0,1,10,12,3,4,5,6,7,8,9,20,13,22,23,24,25,26,21,27,31,28,29,14,30,

%T 32,15,33,34,41,35,36,37,51,38,39,40,42,16,43,44,45,46,17,47,48,49,50,

%U 52,53,54,55,56,61,57,58,59,60,62,63,71,64,65,66,67,68,69,70

%N List run lengths of digits different from '1'. Lexicographically first such sequence of nonnegative numbers with no repeated terms.

%C In the concatenation of all terms of this sequence, "201101234567892013...", consider the digits '1' as delimiters of chunks of other digits, "20", "", "0", "2345678920", .... The lengths of these chunks are given by the terms of the sequence.

%H E. Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2015-August/015191.html">To reach the next "1"</a>, SeqFan list, August 10, 2015.

%e The sequence cannot start with a(1) = 0, which would imply starting with a chunk of 0 digits different from '1', i.e., a digit '1': contradiction. It also cannot start with a(1) = 1, which would require starting with a string of 1 digit different from '1': contradiction. So it has to start with a(1) = 2 digits different from '1'.

%e The smallest possible choice for the next term is a(2) = 0.

%e Then, the first '1' must occur as a(3) = 1, and be immediately followed by another digit '1', whence a(4) = 10, in order to have a(2) = 0 digits different from 1 in between them.

%e Then, there is a(3) = 1 digit different from '1' until the next '1', occurring in a(5) = 12.

%o (PARI) A261161(n=99,d=1,a=2,p=0,u=[-1],r=u)={for(n=1,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}

%Y Cf. A261160 - A261169 for the variants that use digit '0', ..., '9' as delimiter.

%K nonn,base

%O 1,1

%A _Eric Angelini_ and _M. F. Hasler_, Aug 10 2015