OFFSET
0,2
FORMULA
S(n) = n union {n}.
EXAMPLE
a(0)=0=0_3=0, a(1)={0}=102_3=11, a(2)={0,{0}}=101022_3=278, etc.
MAPLE
N:=proc(n) local i, s, l, r, data; s:=`0`; l:=`1`; r:=`2`; if n>0 then for i from 1 to n-1 do s:=cat(s, l, s, r); od; s:=cat(l, s, r); fi; data:=sscanf(s, `%d`); RETURN(data[1]); end: b3tob10:=proc(n) local i, nl, sl, suma; if n=0 then suma:=0; else sl:=convert(n, base, 10); nl:=convert(sl, base, 3, 10); suma:=sum(nl[i]*10^(i-1), i=1..nops(nl)); fi; RETURN(suma); end: for n from 0 to 7 do b3tob10(N(n)); od;
MATHEMATICA
Join[{0}, Map[FromDigits[#, 3]&, NestList["1"<>StringTake[#, {2, -2}]<>#<>"2"&, "102", 8]]] (* Paolo Xausa, Nov 22 2023 *)
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
I.N. Galidakis (jgal(AT)ath.forthnet.gr), May 14 2007
EXTENSIONS
Missing a(0) inserted by Paolo Xausa, Nov 22 2023
STATUS
approved