OFFSET
1,6
COMMENTS
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 6.
It appears that A108579(n) is the number of ordered triples (w,x,y) with components all in {1,...,n} and w+n=2x+3y, as in the Mathematica section. For related sequences, see A211422. - Clark Kimberling, Apr 15 2012
LINKS
T. Zaslavsky, Table of n, a(n) for n = 1..10000
Matthias Beck and Thomas Zaslavsky, Six little squares and how their numbers grow, Journal of Integer Sequences, 13 (2010), Article 10.6.2.
Matthias Beck and Thomas Zaslavsky, Six little squares and how their numbers grow: Maple Worksheets and Supporting Documentation.
Yu. V. Chebrakov, Section 2.6.3 in "Theory of Magic Matrices. Issue TMM-1.", 2008. (in Russian)
Index entries for linear recurrences with constant coefficients, signature (1,1,0,-1,-1,1).
FORMULA
a(n) = floor((1/4)*(n-2)^2)-floor((1/3)*(n-1)). - Mircea Merca, Oct 08 2013
G.f.: x^5*(1+2*x)/((1-x)*(1-x^2)*(1-x^3)).
EXAMPLE
a(5) = 1 because there is a unique 3 X 3 magic square, up to symmetry, using the first 9 positive integers.
MATHEMATICA
(* This program generates a sequence described in the Comments section *)
t[n_] := t[n] = Flatten[Table[-w^2 + x*y + n, {w, 1, n}, {x, 1, n}, {y, 1, n}]]
c[n_] := Count[t[n], 0]
t = Table[c[n], {n, 1, 80}] (* A211506 *)
(* Clark Kimberling, Apr 15 2012 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Thomas Zaslavsky, Jun 11 2005
EXTENSIONS
Edited by N. J. A. Sloane, Oct 04 2010
STATUS
approved