A304238 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.
10, 101, 11, 110, 201, 12, 21, 112, 121, 111, 113, 31, 13, 131, 114, 41, 14, 141, 115, 51, 15, 151, 116, 61, 16, 161, 117, 71, 17, 171, 118, 81, 18, 181, 119, 91, 19, 191, 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
Offset: 1
Examples
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).
Crossrefs
Cf. A304237.
Programs
-
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
Comments