login
Lexicographically earliest permutation of the positive integers such that a(n) contains the a(n)-th digit of the sequence, for all n.
0

%I #11 Jan 02 2023 12:30:50

%S 1,2,3,4,5,6,7,8,9,11,13,15,17,19,21,22,25,27,29,31,23,33,37,39,41,24,

%T 44,47,49,51,53,45,55,59,61,26,46,66,69,71,73,75,67,77,81,28,48,68,88,

%U 91,93,95,97,89,10,20,40,60,80,111,14,16,18,12,112,42,62,82,113,34,36,38,30,114,116

%N Lexicographically earliest permutation of the positive integers such that a(n) contains the a(n)-th digit of the sequence, for all n.

%H M. F. Hasler in reply to E. Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2014-September/013697.html">The a(n)th digit of the sequence is visible in a(n)</a>, SeqFan list, Sep 27 2014

%e See the link.

%e a(10) cannot be 10 because in that case, the 11th digit would be "0" which does not occur in the number "11", so this number could appear nowhere else in the sequence.

%o (PARI) a(n,print_all=0,d=[],u=0,L)={for(n=1,n,for(k=1,9e9,bittest(u,k)&&next;

%o for(j=1,#dk=digits(k),setsearch(Set(digits(#d+j)),dk[j])||next(2));

%o d=concat(d,digits(k));u+=1<<L=k;print_all&&print1(k",");break));L} \\ _M. F. Hasler_, Sep 27 2014

%K nonn,base

%O 1,2

%A _Eric Angelini_ and _M. F. Hasler_, Sep 27 2014