OFFSET
1,2
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
a(n) = C(2n-1, 2)+(n+1)/2 if n is odd, else a(n) = C(2n, 2)-(n-2)/2.
From Colin Barker, Jul 02 2016: (Start)
a(n) = (5-(-1)^n+2*(-4+(-1)^n)*n+8*n^2)/4.
a(n) = (4*n^2-3*n+2)/2 for n even, a(n) = (4*n^2-5*n+3)/2 for n odd.
a(n) = a(n-1)+2*a(n-2)-2*a(n-3)-a(n-4)+a(n-5) for n>5.
G.f.: x*(1+5*x+4*x^2+5*x^3+x^4) / ((1-x)^3*(1+x)^2). (End)
E.g.f.: ((2 - x + 4*x^2)*cosh(x) + (3 + x + 4*x^2)*sinh(x) - 2)/2. - Stefano Spezia, Sep 10 2024
MAPLE
A057029:=n->(5-(-1)^n+2*(-4+(-1)^n)*n+8*n^2)/4: seq(A057029(n), n=1..80); # Wesley Ivan Hurt, Jul 03 2016
MATHEMATICA
Table[(5 - (-1)^n + 2 (-4 + (-1)^n) n + 8 n^2)/4, {n, 49}] (* or *)
Table[If[OddQ@ n, Binomial[2 n - 1, 2] + (n + 1)/2 , Binomial[2 n, 2] - (n - 2)/2], {n, 49}] (* or *)
Rest@ CoefficientList[Series[x (1 + 5 x + 4 x^2 + 5 x^3 + x^4)/((1 - x)^3 (1 + x)^2), {x, 0, 49}], x] (* Michael De Vlieger, Jul 03 2016 *)
PROG
(PARI) Vec(x*(1+5*x+4*x^2+5*x^3+x^4)/((1-x)^3*(1+x)^2) + O(x^100)) \\ Colin Barker, Jul 02 2016
(Magma) [(5-(-1)^n+2*(-4+(-1)^n)*n+8*n^2)/4 : n in [1..80]]; // Wesley Ivan Hurt, Jul 03 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Jul 28 2000
STATUS
approved