OFFSET
0,2
LINKS
T. D. Noe, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
G.f.: [(1+2x)(1+2x+2x^2+2x^3-x^4)]/[(1-x)^3(1+x)^2]. - Ralf Stephan, Apr 24 2004
From Colin Barker, Jan 26 2016: (Start)
a(n) = (18*n^2+2*(-1)^n*n+18*n-7*(-1)^n-1)/8 for n>0.
a(n) = (9*n^2+10*n-4)/4 for n>0 and even.
a(n) = (9*n^2+8*n+3)/4 for n odd. (End)
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5). - Wesley Ivan Hurt, Apr 19 2023
MATHEMATICA
Join[{1}, LinearRecurrence[{1, 2, -2, -1, 1}, {5, 13, 27, 45, 67}, 40]] (* Harvey P. Dale, Dec 03 2014 *)
PROG
(PARI) a(n)=abs([0, 1, 0, 0, 0; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0; 0, 0, 0, 0, 1; 1, -1, -2, 2, 1]^n*[-1; 5; 13; 27; 45])[1, 1] \\ Charles R Greathouse IV, Jun 16 2015
(PARI) Vec((1+2*x)*(1+2*x+2*x^2+2*x^3-x^4)/((1-x)^3*(1+x)^2) + O(x^100)) \\ Colin Barker, Jan 26 2016
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
STATUS
approved