Office Applications and Entertainment, Magic Squares  Index About the Author

6.0  Magic Squares (6 x 6)

6.1  Analytic Solution, Pan Magic Squares (Don't Exist)

Magic squares of order 6 can be represented as follows:

 a(1) a(2) a(3) a(4) a(5) a(6) a(7) a(8) a(9) a(10) a(11) a(12) a(13) a(14) a(15) a(16) a(17) a(18) a(19) a(20) a(21) a(22) a(23) a(24) a(25) a(26) a(27) a(28) a(29) a(30) a(31) a(32) a(33) a(34) a(35) a(36)

For Pan Magic Squares the numbers a(i), i = 1 ... 36, in all rows, columns, main and broken diagonals should sum to the same constant, which results in following linear equations:

a( 1) + a( 2) + a( 3) + a( 4) + a( 5) + a( 6) = s1
a( 7) + a( 8) + a( 9) + a(10) + a(11) + a(12) = s1
a(13) + a(14) + a(15) + a(16) + a(17) + a(18) = s1
a(19) + a(20) + a(21) + a(22) + a(23) + a(24) = s1
a(25) + a(26) + a(27) + a(28) + a(29) + a(30) = s1
a(31) + a(32) + a(33) + a(34) + a(35) + a(36) = s1

a( 1) + a( 7) + a(13) + a(19) + a(25) + a(31) = s1
a( 2) + a( 8) + a(14) + a(20) + a(26) + a(32) = s1
a( 3) + a( 9) + a(15) + a(21) + a(27) + a(33) = s1
a( 4) + a(10) + a(16) + a(22) + a(28) + a(34) = s1
a( 5) + a(11) + a(17) + a(23) + a(29) + a(35) = s1
a( 6) + a(12) + a(18) + a(24) + a(30) + a(36) = s1

a( 1) + a( 8) + a(15) + a(22) + a(29) + a(36) = s1
a( 2) + a( 9) + a(16) + a(23) + a(30) + a(31) = s1
a( 3) + a(10) + a(17) + a(24) + a(25) + a(32) = s1
a( 4) + a(11) + a(18) + a(19) + a(26) + a(33) = s1
a( 5) + a(12) + a(13) + a(20) + a(27) + a(34) = s1
a( 6) + a( 7) + a(14) + a(21) + a(28) + a(35) = s1

a( 6) + a(11) + a(16) + a(21) + a(26) + a(31) = s1
a( 5) + a(10) + a(15) + a(20) + a(25) + a(36) = s1
a( 4) + a( 9) + a(14) + a(19) + a(30) + a(35) = s1
a( 3) + a( 8) + a(13) + a(24) + a(29) + a(34) = s1
a( 2) + a( 7) + a(18) + a(23) + a(28) + a(33) = s1
a( 1) + a(12) + a(17) + a(22) + a(27) + a(32) = s1

which can be reduced, by means of row and column manipulations, to:

```a(31) =        s1 - a(32) - a(33) - a(34) - a(35) - a(36)
a(25) =        s1 - a(26) - a(27) - a(28) - a(29) - a(30)
a(19) =        s1 - a(20) - a(21) - a(22) - a(23) - a(24)
a(17) =  2/3 * s1 - a(18) + a(20) + a(21) - a(23) - a(24) + a(26) + a(27) - a(29) - a(30) - a(35) - a(36)
a(16) =    2 * s1 + a(18) - a(20) - 2*a(21) - 2*a(22) - a(23) - a(26) - 2*a(27) - 2*a(28) - a(29) - a(34) + a(36)
a(15) =  2/3 * s1 - a(18) - a(33) - a(36)
a(14) =             a(18) - a(20) - a(21) + a(23) + a(24) - a(26) - a(27) + a(29) + a(30) - a(32) + a(36)
a(13) = -4/3 * s1 - a(18) + a(20) + 2*a(21) + 2*a(22) + a(23) + a(26) + 2*a(27) + 2*a(28) + a(29) - a(31) - a(36)
a(12) = 11/6 * s1 - a(20) - a(21) - a(22) - a(26) - 2*a(27) - a(28) - a(32) - a(33) - a(34)
a(11) = -7/6 * s1 + a(22) + a(23) + a(24) - a(26) + a(28) + a(29) + a(30) + a(34) + a(35) + a(36)
a(10) = -7/6 * s1 + a(21) + a(22) + a(23) - a(25) + a(27) + a(28) + a(29) + a(33) + a(34) + a(35)
a(9)  = -7/6 * s1 + a(20) + a(21) + a(22) + a(26) + a(27) + a(28) - a(30) + a(32) + a(33) + a(34)
a(8)  = 11/6 * s1 - a(22) - a(23) - a(24) - a(28) - 2*a(29) - a(30) - a(34) - a(35) - a(36)
a(7)  = 11/6 * s1 - a(21) - a(22) - a(23) - a(27) - 2*a(28) - a(29) - a(33) - a(34) - a(35)
a(6)  = -5/6 * s1 - a(18) + a(20) + a(21) + a(22) - a(24) + a(26) + 2*a(27) + a(28) - a(30)+a(32)+a(33)+a(34)-a(36)
a(5)  =  1/2 * s1 + a(18) + a(19) + a(24) - a(27) - a(28) - a(29) - a(34) - a(35)
a(4)  =  1/6 * s1 - a(18) + a(20) + a(21) - a(28) - a(29) - a(30) + a(31) + a(32)
a(3)  =  1/2 * s1 + a(18) - a(20) - 2*a(21) - a(22) - a(26) - 2*a(27) - a(28) + a(30) + a(31) + a(35) + 2*a(36)
a(2)  =  1/6 * s1 - a(18) + a(21) + a(22) - a(25) - a(26) - a(30) + a(34) + a(35)
a(1)  =  1/2 * s1 + a(18) + a(23) + a(24) - a(25) - a(26) - a(27) - a(31) - a(32)
```

Although the linear equations shown above can be solved for any magic constant s1, it is obvious that no solution can be found for the consecutive integers {1 ... 36}, as the related magic constant s1 = 111 is odd.

Solutions for non consecutive integers, resulting in other magic constants, will be discussed in Section 6.09.

Note: It can be proven that Pan Magic Squares based on consecutive integers don't exist for any order (4n + 2).

6.2  Analytic Solution, Simple Magic Squares

6.2a General

For solutions with consecutive integers we moderate the definition to all rows, columns and main diagonals sum to the same constant, which results in following linear equations:

a( 1) + a( 2) + a( 3) + a( 4) + a( 5) + a( 6) = s1
a( 7) + a( 8) + a( 9) + a(10) + a(11) + a(12) = s1
a(13) + a(14) + a(15) + a(16) + a(17) + a(18) = s1
a(19) + a(20) + a(21) + a(22) + a(23) + a(24) = s1
a(25) + a(26) + a(27) + a(28) + a(29) + a(30) = s1
a(31) + a(32) + a(33) + a(34) + a(35) + a(36) = s1

a( 1) + a( 7) + a(13) + a(19) + a(25) + a(31) = s1
a( 2) + a( 8) + a(14) + a(20) + a(26) + a(32) = s1
a( 3) + a( 9) + a(15) + a(21) + a(27) + a(33) = s1
a( 4) + a(10) + a(16) + a(22) + a(28) + a(34) = s1
a( 5) + a(11) + a(17) + a(23) + a(29) + a(35) = s1
a( 6) + a(12) + a(18) + a(24) + a(30) + a(36) = s1

a( 1) + a( 8) + a(15) + a(22) + a(29) + a(36) = s1

a( 6) + a(11) + a(16) + a(21) + a(26) + a(31) = s1

which can be reduced, by means of row and column manipulations, to:

```a(31) = s1 - a(32) - a(33) - a(34) - a(35) - a(36)
a(25) = s1 - a(26) - a(27) - a(28) - a(29) - a(30)
a(19) = s1 - a(20) - a(21) - a(22) - a(23) - a(24)
a(13) = s1 - a(14) - a(15) - a(16) - a(17) - a(18)
a(11) =    + a(12) - a(16) + a(18) - a(21) + a(24) - a(26) + a(30) - a(31) + a(36)
a( 8) =   {- a( 9) - a(10) - 2*a(11) - a(14) - 2*a(15) - 2*a(16) - a(17) + 2*a(19) + a(20) + a(23) + 2*a(24) + 2*a(25)
+ a(27) + a(28) + 2*a(30)}/2
a( 7) =      a( 8) - a(13) + a(15) - a(19) + a(22) - a(25) + a(29) - a(31) + a(36)
a( 6) = s1 - a(11) - a(16) - a(21) - a(26) - a(31)
a( 5) = s1 - a(11) - a(17) - a(23) - a(29) - a(35)
a( 4) = s1 - a(10) - a(16) - a(22) - a(28) - a(34)
a( 3) = s1 - a( 9) - a(15) - a(21) - a(27) - a(33)
a( 2) = s1 - a( 8) - a(14) - a(20) - a(26) - a(32)
a( 1) = s1 - a( 8) - a(15) - a(22) - a(29) - a(36)
```

The linear equations shown above are ready to be solved, for the magic constant 111.

However the solutions can only be obtained by guessing a(9), a(10), a(12), a(14) .. a(18), a(20) .. a(24), a(26) .. a(30) and a(32) .. a(36) and filling out these guesses in the abovementioned equations.

For distinct integers also following relations should be applied:

0 < a(i) =< 36        for i = 1, 2, ... 8, 11, 13, 19, 25
Int(a(i)) = a(i)      for i = 8
a(i) ≠ a(j)           for i ≠ j

which can be incorporated in a guessing routine, which can be used to generate - if not all - at least collections of 6th order squares with distinct integers within a reasonable time (MgcSqr6b).

The number of simple magic squares of order 6 is gigantic and estimated to be 1,77 1019, which is likely because the squares are determined by 23 independent variables (red).

 6 32 3 34 35 1 7 11 27 28 8 30 19 14 16 15 23 24 18 20 22 21 17 13 25 29 10 9 26 12 36 5 33 4 2 31

With the highlighted variables constant, above mentioned guessing routine (MgcSqr6b), produced 856 Simple Magic Squares of the 6th order within 56 minutes, which are shown in Attachment 6.5.1.

6.2b Alternative Routine

A much faster routine - in which after the bottom row, first the main diagonals and afterward the remaining rows and columns are calculated - can be developed.

This sequence together with the properties of a Simple Magic Square result, after deduction, in following set of linear equations:

a(31) = s1 - a(32) - a(33) - a(34) - a(35) - a(36)
a( 1) = s1 - a( 8) - a(15) - a(22) - a(29) - a(36)
a( 5) = s1 - a(11) - a(17) - a(23) - a(29) - a(35)
a( 6) = s1 - a(11) - a(16) - a(21) - a(26) - a(31)
a( 2) = s1 - a( 8) - a(14) - a(20) - a(26) - a(32)
a( 4) = s1 - a( 1) - a( 2) - a( 3) - a( 5) - a( 6)
a(10) = s1 - a( 4) - a(16) - a(22) - a(28) - a(34)
a( 9) = s1 - a( 3) - a(15) - a(21) - a(27) - a(33)
a(19) = s1 - a(20) - a(21) - a(22) - a(23) - a(24)
a(13) = s1 - a(14) - a(15) - a(16) - a(17) - a(18)
a( 7) = s1 - a( 8) - a( 9) - a(10) - a(11) - a(12)
a(25) = s1 - a( 1) - a( 7) - a(13) - a(19) - a(31)
a(30) = s1 - a(12) - a(18) - a(24) - a( 6) - a(36)

The solutions can be obtained by guessing the 23 parameters:

a(i) for i = 3, 8, 11, 12, 14 ... 18, 20 ... 24, 26 ... 29, 32 ... 36

and filling out these guesses in the abovementioned equations.

The linear equations shown above can be incorporated in a guessing routine, in which the relations ensuring Unique Essential Different Simple Magic Squares:

a(36) is the smallest of all integers in the two main diagonals
a(29) < a(8),  a(22) < a(15), a(29) < a(22)
a(31) < a(6)

can be incorporated (MgcSqr6a).

With row a(31) - a(36), diagonal a(1) - a(36) and column a(5) - (35) constant, subject routine counted 23742 Essential Different Magic Squares within 52 seconds, of which the first 856 are shown in Attachment 6.6.1.

6.2c Bimagic Diagonals

A Magic Square is Bimagic if it remains magic after each of the numbers have been squared. It has been proven that Bimagic Squares of order 6 can't exist. However Simple Magic Squares of order 6 can have Bimagic Diagonals.

Simple Magic Squares with Bimagic Diagonals can be constructed based on the 98 Bimagic Series (ref. Attachment 6.2.1) as previously published by Christian Boyer (25 may 2002).

The diagonals can be read from these series, the related variables per diagonal can be permutated as required and the square can be completed.

A routine - in which after the main diagonals the remaining rows and columns are calculated - can be used to generate Simple Magic Squares with Bimagic Diagonals (ref. MgcSqr62c).

Attachment 6.2.2 shows the first occurring Simple Magic Square with Bimagic Diagonals for each suitable set of Bimagic Series (1694).

6.2d Partly Bimagic Squares

Although Bimagic Squares of order 6 can't exist, it is possible to construct Partly Bimagic Squares of order 6 with following procedure:

• Based on the 98 Bimagic Series (ref. Attachment 6.2.1) 8 squares with 6 bimagic rows can be obtained, which are shown in Attachment 6.2.3;
• Based on the 8 'Generators' obtained above, numerous (transposed) Semi Magic Squares with 6 bimagic columns can be constructed by permutating the numbers within the rows;
• By permutation of the rows and columns within the Semi Magic Squares, Partly Bimagic Squares with at least 6 bimagic columns can be obtained.

The procedure described above is illustrated below for the first occurring Partly Bimagc Square based on Generator 1:

Generator 1
 28 26 25 24 6 2 31 29 23 15 12 1 33 32 17 13 9 7 34 30 18 14 10 5 35 27 19 16 11 3 36 22 21 20 8 4
Semi Magic Square
 28 31 32 5 11 4 26 29 17 14 3 22 25 23 13 10 19 21 24 12 33 18 16 8 6 1 7 34 27 36 2 15 9 30 35 20
Simple Magic Square
 34 27 6 1 36 7 5 11 28 31 4 32 14 3 26 29 22 17 10 19 25 23 21 13 18 16 24 12 8 33 30 35 2 15 20 9

and is a variation on the methods used by e.g. Achille Rilly (1901) for the construction of Bimagic Squares of order 8 based on limited amounts of Bimagic Series (ref. Section 15.3.1).

A routine - in which the required permutations are executed - can be used to generate Partly Bimagic Squares (ref. CnstrSqrs6).

Attachment 6.2.4 shows the first occurring Partly Bimagic Square of order 6 for each of the eight Generators.

Methods to construct Bimagic Squares of order 6 based on non consecutive integers, will be discussed in Section 15.7.

6.3  Transformations and Standard Positions

6.3a Transformations

For simple magic squares, related squares can be found by means of rotation and/or reflection (ref. Attachment 6.5.2).

Further, each 6th order simple magic square corresponds with 24 transformations as described below:

• Any line n can be interchanged with line (7 - n). As any combination of these 3 simple permutations can be applied, the resulting number of transformations is 23 = 8, which are shown in Attachment 6.5.3.
It should be noted that for each square the 180o rotated aspect is included in this collection.

• Any permutation can be applied to the lines 1, 2, 3 provided that the same permutation is applied to the lines 6, 5, 4. The possible number of transformations is 3! = 6, which are shown in Attachment 6.5.4.

• The resulting number of transformations, excluding the 180o rotated aspects, is 8/2 * 6 = 24, which are shown in Attachment 6.5.5

Based on this set of transformations and the eight squares which can be found by means of rotation and/or reflection any 6th order simple magic square corresponds with a Class of 8 * 24 = 192 magic squares (ref. Attachment 6.5.6).

Magic squares with symmetrical main diagonals, as described in next section and highlighted in red in Attachment 6.5.1, will allow for another Class definition.

6.3b Standard Positions

Standard Position of Unique Magic Squares

Each of the 8 orientations (aspects) can be considered to be the same Unique Magic Square.

The standard Position of Unique Magic Squares is defined by the four corners:

a(36) < a(31), a(6), a(1)
a(31) < a(6)

Standard position of Essential Different Magic Squares

Two different Unique Magic Squares are called Essential Different, if it is not possible to transform one square into the other square by means of the transformations described above.

The standard position of Essential Different Magic Squares is defined by the integers of the two main diagonals:

a(36) is the smallest of all integers in the two main diagonals
a(29) < a(8),  a(22) < a(15), a(29) < a(22)
a(31) < a(6)

An example of a square in standard position - with the main diagonals highlighted - is shown in (ref. Attachment 6.5.6).