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-7*n^2+10*n-8)/4 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.: x^3*(x^3-3*x^2+6*x-10) / (x-1)^5.
EXAMPLE
a(4) = cpg(3, 4) + cpg(4, 4) = 19 + 25 = 44.
MATHEMATICA
CoefficientList[Series[x^3 (x^3 - 3 x^2 + 6 x - 10) / (x - 1)^5, {x, 0, 40}], x] (* Vincenzo Librandi, Apr 15 2015 *)
PROG
(PARI) cpg(m, n) = m*n*(n-1)/2+1
vector(50, n, n--; sum(m=3, n, cpg(m, n)))
(Magma) [0, 0] cat [(n^4-7*n^2+10*n-8)/4 : n in [2..40]]; // Vincenzo Librandi, Apr 15 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Colin Barker, Apr 15 2015
STATUS
approved