OFFSET
0,2
COMMENTS
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).
FORMULA
a(n) = a(-n) = 2*a(n-1) - 2*(n-3) + a(n-4).
a(n+2) = a(n) + 4*n.
a(n+5) = a(n-5) + A008602(n).
G.f.: x*(3 - 2*x + 3*x^2)/((1 + x)*(1 - x)^3). - Bruno Berselli, Oct 15 2014
Sum_{n>=1} 1/a(n) = Pi^2/24 + tanh(Pi/sqrt(2))*Pi/(4*sqrt(2)). - Amiram Eldar, Aug 21 2022
MATHEMATICA
Table[n^2 + 1 - (-1)^n, {n, 0, 60}] (* Vincenzo Librandi, Oct 16 2014 *)
LinearRecurrence[{2, 0, -2, 1}, {0, 3, 4, 11}, 60] (* Harvey P. Dale, Jun 30 2019 *)
PROG
(PARI) vector(100, n, (n-1)^2+1+(-1)^n) \\ Derek Orr, Oct 15 2014
(Magma) [n^2+1-(-1)^n: n in [0..60]]; // Vincenzo Librandi, Oct 16 2014
(Sage) [n^2+1-(-1)^n for n in (0..60)] # Bruno Berselli, Oct 16 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Oct 15 2014
EXTENSIONS
Edited by Bruno Berselli, Oct 16 2014
STATUS
approved