OFFSET
0,4
COMMENTS
The n-th generalized n-gonal number (for n >= 5).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000
Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1).
FORMULA
G.f.: x*(1 - 2*x + x^2 + 7*x^3 - x^4)/((1 - x)^4*(1 + x)^3).
a(n) = [x^n] x*(1 + (n - 4)*x + x^2)/((1 - x)^3*(1 + x)^2).
E.g.f.: (1/16)*((-6 + 9*x + 2*x^2)*exp(-x) + (6 - 5*x + 4*x^2 + 2*x^3)*exp(x)).
a(n) = a(n-1) + 3*a(n-2) - 3*a(n-3) - 3*a(n-4) + 3*a(n-5) + a(n-6) - a(n-7).
a(n) = (2*n^3 - 2*n^2 + (-1)^n*(2*n^2 - 11*n - 6) - 5*n + 6)/16.
MAPLE
a:= n-> (m-> m*((n-2)*m-(n-4))/2)(-ceil(n/2)*(-1)^n):
seq(a(n), n=0..100); # Alois P. Heinz, Aug 29 2018
MATHEMATICA
CoefficientList[Series[x (1 - 2 x + x^2 + 7 x^3 - x^4)/((1 - x)^4 (1 + x)^3), {x, 0, 50}], x]
Table[SeriesCoefficient[x (1 + (n - 4) x + x^2)/((1 - x)^3 (1 + x)^2), {x, 0, n}], {n, 0, 50}]
LinearRecurrence[{1, 3, -3, -3, 3, 1, -1}, {0, 1, -1, 3, 4, 12, 21}, 51]
Table[(2 n^3 - 2 n^2 + (-1)^n (2 n^2 - 11 n - 6) - 5 n + 6)/16, {n, 0, 50}]
PROG
(PARI) x='x+O('x^99); concat(0, Vec(x*(1-2*x+x^2+7*x^3-x^4)/((1-x)^4*(1+x)^3))) \\ Altug Alkan, Sep 18 2017
(GAP) List([0..50], n->(2*n^3-2*n^2+(-1)^n*(2*n^2-11*n-6)-5*n+6)/16); # Muniru A Asiru, Aug 08 2018
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Ilya Gutkovskiy, Sep 18 2017
STATUS
approved