TOPICS
Search

Associative Magic Square


AssociativeMagicSquares4

An associative magic square is an n×n magic square for which every pair of numbers symmetrically opposite the center sum to n^2+1. Here n is a positive integer and the entries are the integers 1, 2, ..., n^2, each used once. The Lo Shu is associative but not panmagic. The numbers of associative magic squares, counted up to rotation and reflection, of order 1, 2, ... are 1, 0, 1, 48, ... (OEIS A081262).

AssociativeMagicSquare

Order four magic squares can be panmagic or associative, but not both. Among nontrivial magic squares, order five magic squares are the smallest which can be both associative and panmagic, and 16 distinct associative panmagic squares exist, one of which is illustrated above (Gardner 1988). The numbers of associative panmagic squares, counted up to rotation and reflection, of order 1, 2, ... are therefore 1, 0, 0, 0, 16, ... (OEIS A081263).

An associative magic square of every positive odd order n=2m+1 can be constructed by two rounds of cyclic shifts (Mamzeris 2026, pp. 3-4). Place n(i-1)+j in row i and column j, using indices 1, 2, ..., n. First shift each row i cyclically to the left by s_i positions, then shift each column i cyclically upward by s_i positions, where

 s_i={i   for 1<=i<=m; 0   for i=m+1; i-1   for m+2<=i<=n.
(1)

The resulting magic square has magic constant n(n^2+1)/2.

Equivalently, the entry V(x,y;n) in column x and row y can be evaluated directly without constructing the other entries (Mamzeris 2026, pp. 4-5). For 1<=x,y<=n, write

Y=1+mod(y-1+s_x,n)
(2)
X=1+mod(x-1+s_Y,n)
(3)
V(x,y;n)=n(Y-1)+X,
(4)

where mod(a,n) is the common residue of a modulo n, chosen between 0 and n-1. The first equation reverses the column shift and the second reverses the row shift. For example, V(2,3;5)=21.


See also

Magic Square, Panmagic Square

Explore with Wolfram|Alpha

References

Gardner, M. "Magic Squares and Cubes." Ch. 17 in Time Travel and Other Mathematical Bewilderments. New York: W. H. Freeman, pp. 213-225, 1988.Mamzeris, S. "The Mamzeris Method: Universal Closed-Form Construction for Odd-Order Magic Squares." Version 3. Sep. 9, 2026. https://doi.org/10.5281/zenodo.22681011.Sloane, N. J. A. Sequences A081262 and A081263 in "The On-Line Encyclopedia of Integer Sequences."

Referenced on Wolfram|Alpha

Associative Magic Square

Cite this as:

Weisstein, Eric W. "Associative Magic Square." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/AssociativeMagicSquare.html

Subject classifications