%I #18 Jan 31 2021 03:07:04
%S 1,30,285,1496,5525,16206,40425,89440,180441,338350,597861,1005720,
%T 1623245,2529086,3822225,5625216,8087665,11389950,15747181,21413400,
%U 28686021,37910510,49485305,63866976,81575625,103200526,129406005,160937560,198628221,243405150
%N Number of possible squares on an n^2 X n^2 grid.
%H Colin Barker, <a href="/A113754/b113754.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (7,-21,35,-35,21,-7,1).
%F a(n) = n^2*(n^2+1)*(2*n^2+1)/6.
%F a(n) = Sum_{k=1..n^2} k^2. - _L. Edson Jeffery_, Sep 05 2013; corrected by _Bruno Berselli_, Sep 06 2013
%F G.f.: x*(1+x)*(1+4*x+x^2)*(1+18*x+x^2) / (1-x)^7. - _Colin Barker_, Mar 22 2016
%e a(2) = 30 because 4^2+3^2+2^2+1^2 = 30.
%p seq((n^2)*(n^2+1)*(2*n^2+1)/6, n=1..40);
%t For[n = 1, n < 30, n++, Print[n^2(n^2 + 1)(2n^2 + 1)/6]] (Steinerberger)
%o (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
%o (Python)
%o def a(n): return n**2 * (n**2+1) * (2*n**2+1) // 6
%o print([a(n) for n in range(1, 31)]) # _Michael S. Branicky_, Jan 30 2021
%K nonn,easy
%O 1,2
%A Robin Hallett (hallettr(AT)uogueplh.ca), Jan 18 2006
%E More terms from _Stefan Steinerberger_, Jan 21 2006