OFFSET
0,3
COMMENTS
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
O.g.f.: (-1 - 3*x - x^2 - 3*x^3)/((-1 + x)^3*(1+x)^2).
E.g.f.: (1/2)*exp(-x)*(-1 - x + exp(2*x)*(1 + x + 2*x^2)).
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5) for n > 4
a(n) = n^2 if n is even.
a(n) = n^2 - n + 1 if n is odd.
MAPLE
a:=n->(1/24)*n*(3 - 3*(- 1)^n + 4*n + 6*n^2 + 8*n^3): seq(a(n), n=0..55);
MATHEMATICA
Table[(1/2)*(- 1+(-1)^n)*(n-1)+n^2, {n, 0, 55}]
PROG
(GAP) Flat(List([0..55], n->(1/2)*(- 1 + (- 1)^n)*(n - 1) + n^2));
(Magma) [(1/2)*(- 1 + (- 1)^n)*(n - 1) + n^2: n in [0..55]];
(PARI) a(n) = (1/2)*(- 1 + (- 1)^n)*(n - 1) + n^2;
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Stefano Spezia, May 13 2019
STATUS
approved