OFFSET
0,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,-2,2,-1,1).
FORMULA
G.f.: 2*x*(1 + 2*x - x^2)/((1 - x)*(1 + x^2)^2).
a(n) = Sum_{k = 0..n} (2k)*(-1)^((-sin((Pi*k)/2) + cos((Pi*k)/2) + 1)/2).
a(n) = 1 - (-1)^(n*(n+1)/2) - (1+(-1)^n)*(-1)^(n/2)*n. [Bruno Berselli, Jan 19 2016]
EXAMPLE
a(0) = 0;
a(1) = 0 + 2 = 2;
a(2) = 0 + 2 + 4 = 6;
a(3) = 0 + 2 + 4 - 6 = 0;
a(4) = 0 + 2 + 4 - 6 - 8 = -8;
a(5) = 0 + 2 + 4 - 6 - 8 + 10 = 2;
a(6) = 0 + 2 + 4 - 6 - 8 + 10 + 12 = 14;
a(7) = 0 + 2 + 4 - 6 - 8 + 10 + 12 - 14 = 0;
a(8) = 0 + 2 + 4 - 6 - 8 + 10 + 12 - 14 - 16 = -16;
a(9) = 0 + 2 + 4 - 6 - 8 + 10 + 12 - 14 - 16 + 18 = 2, etc.
MATHEMATICA
Table[Sum[(2k)*(-1)^((-sin((Pi k)/2)+cos((Pi k)/2)+1)/2), {k, 0, n}], {n, 0, 80}]
CoefficientList[Series[2 x (x^2 - 2 x - 1) / ((x - 1) (x^2 + 1)^2), {x, 0, 100}], x] (* Vincenzo Librandi, Jan 13 2016 *)
Table[1 - (-1)^(n (n + 1)/2) - (1 + (-1)^n) (-1)^(n/2) n, {n, 0, 80}] (* Bruno Berselli, Jan 19 2016 *)
PROG
(PARI) concat(0, Vec(2*x*(1+2*x-x^2)/((1-x)*(1+x^2)^2) + O(x^100))) \\ Michel Marcus, Jan 13 2016
(Magma) &cat [[-8*n, 2, 8*n+6, 0]: n in [0..20]]; // Bruno Berselli, Jan 19 2016
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Ilya Gutkovskiy, Jan 13 2016
STATUS
approved