login
A265755
a(n) = a(n-1) + a(n-2) if n is even and a(n) = a(n-3) + a(n-4) if n is odd, with a(0) = a(1) = a(2) = 0 and a(3) = 1.
1
0, 0, 0, 1, 1, 0, 1, 2, 3, 1, 4, 5, 9, 5, 14, 14, 28, 19, 47, 42, 89, 66, 155, 131, 286, 221, 507, 417, 924, 728, 1652, 1341, 2993, 2380, 5373, 4334, 9707, 7753, 17460, 14041, 31501, 25213, 56714, 45542, 102256, 81927, 184183, 147798, 331981, 266110, 598091, 479779, 1077870, 864201, 1942071, 1557649
OFFSET
0,8
FORMULA
From Colin Barker, Dec 16 2015: (Start)
a(n) = a(n-2) + 2*a(n-4) - a(n-6) for n>5.
G.f.: x^3*(1+x-x^2) / (1-x^2-2*x^4+x^6).
(End)
EXAMPLE
a(8) = a(7) + a(6)
= a(4) + a(3) + a(5) + a(4)
= (a(3) + a(2)) + a(3) + (a(2) + a(1)) + (a(3) + a(2))
= 1 + 1 + 0 + 1
= 3
MATHEMATICA
a[0] = a[1] = a[2] = 0; a[3] = 1; a[n_] := a[n] = If[EvenQ@ n, a[n - 1] + a[n - 2], a[n - 3] + a[n - 4]]; Table[a@ n, {n, 0, 55}] (* Michael De Vlieger, Dec 15 2015 *)
nxt[{n_, a_, b_, c_, d_}]:={n+1, b, c, d, If[OddQ[n], c+d, a+b]}; NestList[nxt, {1, 0, 0, 0, 1}, 60][[All, 2]] (* or *) LinearRecurrence[{0, 1, 0, 2, 0, -1}, {0, 0, 0, 1, 1, 0}, 60] (* Harvey P. Dale, Nov 10 2017 *)
PROG
(PARI) concat(vector(3), Vec(x^3*(1+x-x^2)/(1-x^2-2*x^4+x^6) + O(x^70))) \\ Colin Barker, Dec 16 2015
CROSSREFS
Interleaves A006053 and A052547, with an extra leading 0.
A187066 with even values and odd values swapped and an extra leading 0.
Sequence in context: A305433 A257681 A338240 * A341130 A330139 A349358
KEYWORD
nonn,easy
AUTHOR
Nicholas Drozd, Dec 15 2015
EXTENSIONS
More terms from Michael De Vlieger, Dec 15 2015
STATUS
approved