OFFSET
0,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
a(n) = n^2 + n + 1 - n*(-1)^n = n^2 + n + 1 + n*(-1)^(n+1).
G.f.: (5*x^3-x^2+3*x+1)/((1-x)^3*(1+x)^2). [Colin Barker, Sep 03 2012]
MATHEMATICA
CoefficientList[Series[(5 x^3 - x^2 + 3 x + 1) / ((1 - x)^3 (1 + x)^2), {x, 0, 50}], x] (* Vincenzo Librandi, Aug 08 2013 *)
PROG
(Magma) [n^2+n+1-n*(-1)^n: n in [0..50]]; // Vincenzo Librandi, Aug 08 2013
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Mar 19 2003
STATUS
approved