OFFSET
0,4
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Wikipedia, Centered polygonal number
Index entries for linear recurrences with constant coefficients, signature (5,-10,10,-5,1).
FORMULA
a(n) = (n^4-n^2-12)/6 for n>1.
a(n) = 5*a(n-1)-10*a(n-2)+10*a(n-3)-5*a(n-4)+a(n-5) for n>6.
G.f.: 2*x^3*(x^3-4*x^2+6*x-5) / (x-1)^5.
EXAMPLE
a(4) = cpg(4, 3) + cpg(4, 4) = 13 + 25 = 38.
MATHEMATICA
CoefficientList[Series[2 x^3 (x^3 - 4 x^2 + 6 x - 5) / (x - 1)^5, {x, 0, 40}], x] (* Vincenzo Librandi, Apr 15 2015 *)
LinearRecurrence[{5, -10, 10, -5, 1}, {0, 0, 0, 10, 38, 98, 208}, 40] (* Harvey P. Dale, Dec 26 2015 *)
PROG
(PARI) cpg(m, n) = m*n*(n-1)/2+1
vector(50, n, sum(m=3, n-1, cpg(n-1, m)))
(Magma) [0, 0] cat [(n^4-n^2-12)/6: n in [2..40]]; // Vincenzo Librandi, Apr 15 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Colin Barker, Apr 15 2015
STATUS
approved