OFFSET
1,10
COMMENTS
From Thomas Zaslavsky, Mar 12 2010: (Start)
A magic square has distinct positive integers in its cells, whose sum is the same (the "magic sum") along any row, column, or main diagonal.
a(n) is given by a quasipolynomial of period 12. (End)
LINKS
T. Zaslavsky, Table of n, a(n) for n = 1..10000.
M. Beck and T. Zaslavsky, An enumerative geometry for magic and magilatin labellings, arXiv:math/0506315 [math.CO], 2005; Ann. Combinatorics, 10 (2006), no. 4, 395-413. MR 2007m:05010. Zbl 1116.05071. - Thomas Zaslavsky, Jan 29 2010
M. Beck and T. Zaslavsky, Six little squares and how their numbers grow, submitted. - Thomas Zaslavsky, Jan 29 2010
Matthias Beck and Thomas Zaslavsky, Six Little Squares and How their Numbers Grow, Journal of Integer Sequences, 13 (2010), Article 10.6.2.
Index entries for linear recurrences with constant coefficients, signature (2,-1,0,1,-2,2,-2,1,0,-1,2,-1).
FORMULA
G.f.: (8*x^10*(2*x^2+1)) / ((1-x^6)*(1-x^4)*(1-x)^2).
a(n) is given by a quasipolynomial of period 12.
EXAMPLE
a(10) = 8 because there are 8 3 X 3 magic squares with distinct entries < 10 (they are the standard magic squares).
MATHEMATICA
LinearRecurrence[{2, -1, 0, 1, -2, 2, -2, 1, 0, -1, 2, -1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 16, 40}, 60] (* Jean-François Alcover, Nov 12 2018 *)
CoefficientList[Series[(8 x^10 (2 x^2 + 1)) / ((1 - x^6) (1 - x^4) (1 - x)^2), {x, 0, 60}], x] (* Vincenzo Librandi, Nov 12 2018 *)
PROG
(PARI) a(n)=1/6*(n^3-16*n^2+(76-3*(n%2))*n -[96, 58, 96, 102, 112, 90, 96, 70, 96, 90, 112, 102][(n%12)+1])
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Thomas Zaslavsky and Ralf Stephan, Jun 11 2005
EXTENSIONS
Edited by N. J. A. Sloane, Feb 05 2010
STATUS
approved