login
A122164
a(0) = 0, a(1) = 1, s = 0; for n >= 2, if a(n-1) is even and s = 0 then set a(n) = a(n-1)/2 and s = 1; otherwise set a(n) = a(n-1) + a(n-2) and s = 0.
2
0, 1, 1, 2, 1, 3, 4, 2, 6, 3, 9, 12, 6, 18, 9, 27, 36, 18, 54, 27, 81, 108, 54, 162, 81, 243, 324, 162, 486, 243, 729, 972, 486, 1458, 729, 2187, 2916, 1458, 4374, 2187, 6561, 8748, 4374, 13122, 6561, 19683, 26244, 13122, 39366, 19683, 59049, 78732, 39366
OFFSET
0,4
LINKS
FORMULA
For i >= 1, a(5i) = 3^i, a(5i+1) = 4*3^(i-1), a(5i+2) = 2*3^(i-1), a(5i+3) = 2*3^i, a(5i+4) = 3^i. - N. J. A. Sloane, Aug 06 2008
O.g.f.: x(-1-x-2x^2-x^3-3x^4-x^5+x^6)/(3x^5-1). - R. J. Mathar, Aug 07 2008
MATHEMATICA
Do[a[n] = {0, 1, 1, 2, 1, 3, 4, 2}[[n+1]], {n, 0, 7}]; a[n_] := a[n] = 3*a[n-5]; Array[a, 53, 0] (* Jean-François Alcover, Nov 07 2016 *)
nxt[{s_, a_, b_}]:=If[EvenQ[b]&&s==0, {1, b, b/2}, {0, b, a+b}]; NestList[nxt, {0, 0, 1}, 60][[All, 2]] (* Harvey P. Dale, Oct 25 2020 *)
CROSSREFS
Cf. A000045, A122597. Records give A000792.
Sequence in context: A209125 A209137 A269752 * A210793 A281715 A076632
KEYWORD
nonn
AUTHOR
Philip van den Bossche (filip020667(AT)hotmail.com), Aug 03 2008
EXTENSIONS
Edited by N. J. A. Sloane, Aug 06 2008
Extended by R. J. Mathar, Aug 07 2008
STATUS
approved