OFFSET
1,2
COMMENTS
This sequence has a nice graph. - M. F. Hasler, Aug 16 2015
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..500
EXAMPLE
Starting from 1,2,3,4,5,6,7,8,9 the next number is 12 because after 1,2,3,4,5,6,7,8,9 we must continue with a digit '1'. But 1 is already in the sequence so we need to append a 2, which yields 12. And so on.
MATHEMATICA
a = {1}; c = 0; Do[c = 10 c + Mod[n, 9] + 1; If[! MemberQ[a, c], AppendTo[a, c]; c = 0], {n, 160}]; a (* Ivan Neretin, Aug 14 2015 *)
PROG
(PARI) a(n, show=0, u=[], d=[1, 1])={my(s(d)=Strchr(vectorsmall(d[1], i, (d[2]-2+i)%9+49))); while(n--, show&&print1(s(d)", "); u=setunion(u, [d]); #u>9 && u[10]==[u[1][1]+1, 1] && u=u[10..-1]; d=(d[1]+d[2]-1)%9+1; for(nd=u[1][1], 9e9, if(!setsearch(u, [nd, d]), d=[nd, d]; next(2)))); eval(s(d))} \\ M. F. Hasler, Aug 16 2015
CROSSREFS
KEYWORD
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Sep 14 2009
EXTENSIONS
Edited by Charles R Greathouse IV, Aug 03 2010
STATUS
approved