login
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.
0
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,1
COMMENTS
Unlike A304237, there are no consecutive numbers in the sequence up to n=82.
Could have started sequence with offset a(0)=0 and it would be the same sequence.
EXAMPLE
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).
PROG
(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
CROSSREFS
Cf. A304237.
Sequence in context: A067217 A266175 A304237 * A231889 A066327 A277442
KEYWORD
nonn,base
AUTHOR
Enrique Navarrete, May 08 2018
STATUS
approved