Associative Magic Squares


All pairs of cells symmetrically opposite from the center have the same sum, for example, (a,a), (b,b) in these order 4 and order 5 patterns:

If the square is normal magic, the pairs are complementary.


AssociativeSquares makes these squares. It uses the methods outlined below. Associative squares can also be made with MagicRectangles, the CompleteSquare utility, and SODLS.

Order5Special makes all the order 5 associative squares.

Odd Order

Method I

A method attributed to C.-Y. Jean Chan, Meera G. Mainkar, Sivaram K. Narayan, and Jordan D. Webster
from Holger Danielsson.

Method II

A method attributed to J. P. De Los Reyes, Ahmad Pourdarvish, Chand K. Midha, and Ashish Das
from Holger Danielsson.

Method III

A method attributed to L. S. Frierson from Holger Danielsson.
These include squares from the methods of Philippe de la Hire and Jean-Joseph Rallier des Ourmes.

Method IV

A method from Bogdan Golunski.
See directory: /mag. squares/magic squares/symmetrical magic squares/construction method I/

Method V

A technique of Marios Mamzeris.

Method VI

Method V with the added feature that rows and/or columns of the initial table are randomly swapped.

Method VII

The Siamese method. See "Demanding the square is associative" in math behind the Siamese method.
These are two squares. Methods for these are also given by Holger Danielsson.
See Ḥasan Ibn al-Haytham; Claude Gaspard Bachet de Méziriac; Simon de la Loubère;
some J. P. De Los Reyes, Ahmad Pourdarvish, Chand K. Midha, and Ashish Das; Yun-er Liao, Bao-man Zhu, and Lian-fa Wu;
Harry A. Sayles, (Lozenge-Squares); Manuel Moschopoulos (1); Brian S. Reiner; and Zhao Li-hua.

Method VIII

William Walkington has a remarkable method that uses equations for the relative coordinates of numbers.
See link to download MTCVS 161019.pdf. Some of the squares from these equations are created here.

How Many

There are 48,544 order 5 associative magic squares. These are group 7 of the Complement Pair Pattern Groups.

There are 1,125,154,039,419,854,784 order 7 associative magic squares.
The number was determined by Go Cato in 2018.

See OEIS A081262.

Planck's A-D Method

Even order associative magic squares can be transformed to/from pandiagonal complete magic squares by this method:

In the example below, (e E), (f F), ... represent complement pairs. The cells of one broken diagonal are shown in color.

Singly-Even Order

There are no associative magic squares of singly-even order.


C. Planck showed in 1919 that there are no pandiagonal magic squares of singly-even order, and observed:

    The same result also follows for associated squares, for if an associated square
    of these orders existed it could be transformed into a pandiagonal by the A-D method.

A proof similar to that of Planck can be given directly for associative squares, (without involving pandiagonals). Let n be the order of the square, m = n/2, and Σ the magic sum. Consider a 4k+2, k≥1, square where (a A), (b B), ... are complement pairs and W, X, Y are the sums of square quarters:

  Summing rows:             W + X = mΣ
  Summing columns:          W + Y = mΣ
  Summing complement pairs: X + Y = mΣ

Thus, W = X = Y = mΣ/2 = 2m⁴ + m²/2 which cannot be, because if m is odd, m²/2 is fractional.


There are singly-even magic squares in which only two complement pairs are not center symmetric.
This is the minimum, because if one pair is not center symmetric, at least one other pair must not be.

AssociativeSquares makes these squares based on Conway's LUX method.

To get near-associative squares of order n = 4k+2:

where, for example, L' is the symmetric complement of L.

Possible patterns for n = 6, 10, 14, 18 are:

Orders 6, 14, 22, 30, ... and 10, 18, 26, 34, ... have similar patterns, (differences shown in blue).

This gives a semi-magic square with only two complement pairs not center symmetric.
Swap appropriate row(s) or column(s) to make the square magic.

Doubly-Even Order

Method I

A 9-block method attributed to Muhammad Al-Asfizari from Holger Danielsson.
The order 4 pattern is the same as given for doubly even magic squares on Wolfram.

Method II

Method I with the added feature that the patterns of smaller 4k orders are also used in subsquares.
For example, for order 24, patterns of orders 4, 8, 12, and 24 are used.

Method III

Method of reversions attributed to C. Planck from Holger Danielsson

Method IV

Margossian pandiagonal Method IV converted to associative by Planck's A-D method.

There are 48 order 4 associative magic squares. These are TYPE III in the classification by Dudeney.

Odd Associative, Even Associative

For odd orders, associative pair numbers are either both odd or both even. Squares that are not associative can also have all odd pairs associative or all even pairs associative. These types are an idea of Craig Knecht.

Associative Not Magic

There are squares that are associative but not magic. One example of these is made by simply writing the ordered sequence 1 to n2:

These are called natural squares. See Planck. See also reversible squares.


Associative squares remain associative, not only under Transform 1 and Transform 2, but by swapping only the described rows or columns. So, from each even order associative square, the total number of resulting squares is:


For odd order, the number is that for order n - 1.


         Order     Transforms1_2All    Swap Rows or Columns Only
       --------   ------------------  ---------------------------
         4,  5                  4                        16
             7                 24                       576
         8,  9                192                    36,864
            11              1,920                 3,686,400         
        12, 13             23,040               530,841,600


Danielsson, Holger "Magic Squares"

Dudeney, Henry E. "Magic Square Problems"

Golunski, Bogdan "NUMBER GALAXY"
  See directory: /mag. squares/magic squares/symmetrical magic squares/construction method I/

Heinz, Harvey "Order 4 Magic Squares"

Hospel, Ton "The math behind the Siamese method of generating magic squares"

Kato, Go "The number of associative magic squares of order 7"

Mamzeris, Marios "Magic Squares of odd order by Marios Mamzeris"


Trump, Walter "Notes on Magic Squares"

Walkington, William "Magic Squares, Spheres and Tori "

Weisstein, Eric W. "Associative Magic Square." From MathWorld--A Wolfram Web Resource.