OFFSET
1,2
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (7,-21,35,-35,21,-7,1).
FORMULA
a(n) = n^2*(n^2+1)*(2*n^2+1)/6.
a(n) = Sum_{k=1..n^2} k^2. - L. Edson Jeffery, Sep 05 2013; corrected by Bruno Berselli, Sep 06 2013
G.f.: x*(1+x)*(1+4*x+x^2)*(1+18*x+x^2) / (1-x)^7. - Colin Barker, Mar 22 2016
EXAMPLE
a(2) = 30 because 4^2+3^2+2^2+1^2 = 30.
MAPLE
seq((n^2)*(n^2+1)*(2*n^2+1)/6, n=1..40);
MATHEMATICA
For[n = 1, n < 30, n++, Print[n^2(n^2 + 1)(2n^2 + 1)/6]] (Steinerberger)
PROG
(PARI) Vec(x*(1+x)*(1+4*x+x^2)*(1+18*x+x^2)/(1-x)^7 + O(x^50)) \\ Colin Barker, Mar 22 2016
(Python)
def a(n): return n**2 * (n**2+1) * (2*n**2+1) // 6
print([a(n) for n in range(1, 31)]) # Michael S. Branicky, Jan 30 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Robin Hallett (hallettr(AT)uogueplh.ca), Jan 18 2006
EXTENSIONS
More terms from Stefan Steinerberger, Jan 21 2006
STATUS
approved