OFFSET
0,1
MATHEMATICA
a[0] = 10; a[n_] := a[n] = Switch[ Mod[a[n - 1], 3], 0, a[n - 1]/3, 1, 4a[n - 1] + 2, 2, 4a[n - 1] - 2]; Table[ a[n], {n, 0, 102}] (* Robert G. Wilson v, Nov 10 2005 *)
nxt[a_]:=Module[{m=Mod[a, 3]}, Which[m==0, a/3, m==1, 4a+2, m==2, 4a-2]]; NestList[ nxt, 10, 110] (* or *) PadRight[{10, 42, 14, 54, 18}, 120, {2, 6}] (* Harvey P. Dale, Feb 19 2018 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Edwin F. Sampang, Nov 04 2005
STATUS
approved