%I #24 Jun 28 2018 15:00:37
%S 10,101,11,110,201,12,21,112,121,111,113,31,13,131,114,41,14,141,115,
%T 51,15,151,116,61,16,161,117,71,17,171,118,81,18,181,119,91,19,191,
%U 211,120,301,130,401,140,501,150,601,160,701,170,801,180,901,190,1001,311,132,210,102,212,22,122,213,32,23,232
%N a(n) is the smallest positive integer not yet in the sequence that is obtained when the first and last digits of a(n-1) are exchanged and used in a(n) in the exchanged order (and necessarily adjacent); a(1)=10.
%C Unlike A304237, there are no consecutive numbers in the sequence up to n=82.
%C Could have started sequence with offset a(0)=0 and it would be the same sequence.
%e a(8)=112 since 112 is the smallest positive number not yet in the sequence that is obtained when the first and last digits of a(7)=21 are exchanged and used adjacent in that order (without the adjacency condition, we would have a(8)=102 as in A304237).
%o (PARI) firstTerms(n)={my(Seq=vector(n),a=[1,0],c,y,k,h=Vecsmall(0,1000*n));print1("10, ");Seq[1]=10;h[11]=1;for(i=2,n,for(t=11,oo,if(!h[t+1],c=digits(t);y=1;while((y<#c)&&(!c[y]),y++);for(u=y,#c-1,if(k=([c[u],c[u+1]]==[a[#a],a[1]]),break));if(k,Seq[i]=t;print1(t", ");a=c;h[t+1]=1;break))));return(Seq)} \\ _R. J. Cano_, May 11 2018
%Y Cf. A304237.
%K nonn,base
%O 1,1
%A _Enrique Navarrete_, May 08 2018
|