login
A122597
a(0) = 1, a(1) = 2, s = 1; 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.
1
1, 2, 3, 5, 8, 4, 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, 118098, 59049
OFFSET
0,2
FORMULA
For n >= 6, a(n) = A122164(n+5), so there is an explicit formula for the n-th term.
G.f.: -(15*x^10-15*x^9+3*x^8-3*x^7+6*x^6+x^5+8*x^4+5*x^3+3*x^2+2*x+1) / (3*x^5-1). - Alois P. Heinz, Jul 29 2013
MAPLE
a:= n-> if n<=5 then [1, 2, 3, 5, 8, 4][n+1] else [2, 1, 3, 4, 2][modp(n+2, 5)+1] *3^iquo(n+2, 5) fi: seq (a(n), n=0..50); # Alois P. Heinz, Sep 02 2008
MATHEMATICA
Do[a[n] = {1, 2, 3, 5, 8, 4, 12, 6, 18, 9, 27}[[n+1]], {n, 0, 10}]; a[n_] := a[n] = 3 a[n-5]; Array[a, 50, 0] (* Jean-François Alcover, Nov 07 2016 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Aug 06 2008
EXTENSIONS
More terms from Alois P. Heinz, Sep 02 2008
STATUS
approved