OFFSET
0,2
PROG
(PARI) a(n, show=1, L=4, v=[0, 3], D=v->v[2..-1]-v[1..-2])={while(#v<=n, show&&print1(v[#v]", "); v=concat(v, v[#v]); while(v[#v]++, forvec(i=vector(L, j, [if(j<L, j, #v), #v]), #Set(D(vecextract(v, i)))>1||next(2), 2); break)); if(type(show)=="t_VEC", v, v[n+1])} \\ 2nd (optional) arg: zero = silent, nonzero = verbose, vector (e.g. [] or [1]) = get the whole list [a(1..n)] as return value, else just a(n). - M. F. Hasler, Jan 18 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Jan 18 2016
STATUS
approved