Office Applications and Entertainment, Magic Squares Index About the Author

8.2   Magic Squares, Composed of Sub Squares

8.2.7 Analytic Solution, Pan Magic Squares composed of Pan Magic Sub Squares,
Containing Magic Middle Squares

The following 8th order Pan Magic Square is composed out of four 4th order Pan Magic Sub Squares and contains - in addition to this - four 4th order Magic Middle Squares.

 23 45 4 58 55 13 36 26 2 60 21 47 34 28 53 15 61 7 42 20 29 39 10 52 44 18 63 5 12 50 31 37 19 41 8 62 51 9 40 30 6 64 17 43 38 32 49 11 57 3 46 24 25 35 14 56 48 22 59 1 16 54 27 33

To describe subject Pan Magic Square analytically following equations should be added to the equations describing Pan Magic Squares composed out of four Pan Magic Sub Squares (ref. Section 8.2.1).

Magic Middle Squares:

 a( 3)+a( 4)+a( 5)+a( 6) = s1/2 a(11)+a(12)+a(13)+a(14) = s1/2 a(19)+a(20)+a(21)+a(22) = s1/2 a(27)+a(28)+a(29)+a(30) = s1/2 a(35)+a(36)+a(37)+a(38) = s1/2 a(43)+a(44)+a(45)+a(46) = s1/2 a(51)+a(52)+a(53)+a(54) = s1/2 a(59)+a(60)+a(61)+a(62) = s1/2 a(17)+a(25)+a(33)+a(41) = s1/2 a(18)+a(26)+a(34)+a(42) = s1/2 a(19)+a(27)+a(35)+a(43) = s1/2 a(20)+a(28)+a(36)+a(44) = s1/2 a(21)+a(29)+a(37)+a(45) = s1/2 a(22)+a(30)+a(38)+a(46) = s1/2 a(23)+a(31)+a(39)+a(47) = s1/2 a(24)+a(32)+a(40)+a(48) = s1/2 a( 3)+a(12)+a(21)+a(30) = s1/2 a(27)+a(20)+a(13)+a( 6) = s1/2 a(17)+a(26)+a(35)+a(44) = s1/2 a(41)+a(34)+a(27)+a(20) = s1/2 a(21)+a(30)+a(39)+a(48) = s1/2 a(45)+a(38)+a(31)+a(24) = s1/2 a(35)+a(44)+a(53)+a(62) = s1/2 a(59)+a(52)+a(45)+a(38) = s1/2

The resulting number of equations can be written in the matrix representation as:

A4 * a = s

which can be reduced, by means of row and column manipulations, and results in following set of linear equations:

```a(61) =  0.5  * s1 - a(62) - a(63) - a(64)
a(59) =            - a(60) + a(63) + a(64)
a(58) =              a(60) + a(62) - a(64)
a(57) =  0.5  * s1 - a(60) - a(62) - a(63)
a(55) =  0.5  * s1 - a(56) - a(63) - a(64)
a(54) =              a(56) - a(62) + a(64)
a(53) =            - a(56) + a(62) + a(63)
a(52) =              a(56) + a(60) - a(64)
a(51) =  0.5  * s1 - a(56) - a(60) - a(63)
a(50) =              a(56) + a(60) - a(62)
a(49) =            - a(56) - a(60) + a(62) + a(63) + a(64)
a(48) =  0.25 * s1 - a(62)
a(47) = -0.25 * s1 + a(62) + a(63) + a(64)
a(46) =  0.25 * s1 - a(64)
a(45) =  0.25 * s1 - a(63)
a(44) =  0.25 * s1 - a(60) - a(62) + a(64)
a(43) = -0.25 * s1 + a(60) + a(62) + a(63)
a(42) =  0.25 * s1 - a(60)
a(41) =  0.25 * s1 + a(60) - a(63) - a(64)
a(40) =  0.25 * s1 - a(56) + a(62) - a(64)
a(39) =  0.25 * s1 + a(56) - a(62) - a(63)
a(38) =  0.25 * s1 - a(56)
a(37) = -0.25 * s1 + a(56) + a(63) + a(64)
a(36) =  0.25 * s1 - a(56) - a(60) + a(62)
a(35) =  0.25 * s1 + a(56) + a(60) - a(62) - a(63) - a(64)
a(34) =  0.25 * s1 - a(56) - a(60) + a(64)
a(33) = -0.25 * s1 + a(56) + a(60) + a(63)
a(31) =              a(32) + a(63) - a(64)
a(30) =            - a(32) + a(62) + a(64)
a(29) =  0.5  * s1 - a(32) - a(62) - a(63)
a(28) =              a(32) + a(60) - a(64)
a(27) =              a(32) - a(60) + a(63)
a(26) =            - a(32) + a(60) + a(62)
a(25) =  0.5  * s1 - a(32) - a(60) - a(62) - a(63) + a(64)
a(24) =            - a(32) + a(56) + a(64)
a(23) =  0.5  * s1 - a(32) - a(56) - a(63)
a(22) =              a(32) + a(56) - a(62)
a(21) =              a(32) - a(56) + a(62) + a(63) - a(64)
a(20) =            - a(32) + a(56) + a(60)
a(19) =  0.5  * s1 - a(32) - a(56) - a(60) - a(63) + a(64)
a(18) =              a(32) + a(56) + a(60) - a(62) - a(64)
a(17) =              a(32) - a(56) - a(60) + a(62) + a(63)
a(16) =  0.25 * s1 + a(32) - a(62) - a(64)
a(15) = -0.25 * s1 + a(32) + a(62) + a(63)
a(14) =  0.25 * s1 - a(32)
a(13) =  0.25 * s1 - a(32) - a(63) + a(64)
a(12) =  0.25 * s1 + a(32) - a(60) - a(62)
a(11) = -0.25 * s1 + a(32) + a(60) + a(62) + a(63) - a(64)
a(10) =  0.25 * s1 - a(32) - a(60) + a(64)
a( 9) =  0.25 * s1 - a(32) + a(60) - a(63)
a( 8) =  0.25 * s1 - a(32) - a(56) + a(62)
a( 7) =  0.25 * s1 - a(32) + a(56) - a(62) - a(63) + a(64)
a( 6) =  0.25 * s1 + a(32) - a(56) - a(64)
a( 5) = -0.25 * s1 + a(32) + a(56) + a(63)
a( 4) =  0.25 * s1 - a(32) - a(56) - a(60) + a(62) + a(64)
a( 3) =  0.25 * s1 - a(32) + a(56) + a(60) - a(62) - a(63)
a( 2) =  0.25 * s1 + a(32) - a(56) - a(60)
a( 1) = -0.25 * s1 + a(32) + a(56) + a(60) + a(63) - a(64)
```

Based on the equations above it can be proven that also the 4 x 4 Center Square is Magic as:

a(19) + a(28) + a(37) + a(46) = s1/2
a(22) + a(29) + a(36) + a(43) = s1/2

The solutions can be obtained by guessing a(32), a(56), a(60) and a(62) ... a(64) and filling out these guesses in the abovementioned equations.

For distinct integers also following inequalities should be applied:

0 < a(i) =< 64        for i = 1, 2 ... 31, 33 ... 55, 57 ... 59, 61
a(i) ≠ a(j)           for i ≠ j

An optimized guessing routine (MgcSqr8b2), produced 46080 (= 64 * 720) Pan Magic Squares, of which the first 720 are shown in Attachment 8.2.4.

8.2.8 Analytic Solution, Magic Squares composed of Magic Sub Squares,
Containing Magic Middle Squares (Bent Diagonals)

The following 8th order Magic Square is composed out of four 4th order Magic Sub Squares and contains - in addition to this - four 4th order Magic Middle Squares.

For all Magic Sub Squares sum the (Main) Bent Diagonals (ref. Section 8.4) to 130.

 1 43 24 62 33 11 56 30 22 64 3 41 54 32 35 9 59 17 46 8 27 49 14 40 48 6 57 19 16 38 25 51 5 47 20 58 37 15 52 26 18 60 7 45 50 28 39 13 63 21 42 4 31 53 10 36 44 2 61 23 12 34 29 55

To describe subject Magic Square analytically following equations should be added to the equations describing Magic Squares composed out of four Magic Sub Squares (ref.Section 8.2.3).

Magic Middle Squares:

 a( 3)+a( 4)+a( 5)+a( 6) = s1/2 a(11)+a(12)+a(13)+a(14) = s1/2 a(19)+a(20)+a(21)+a(22) = s1/2 a(27)+a(28)+a(29)+a(30) = s1/2 a(35)+a(36)+a(37)+a(38) = s1/2 a(43)+a(44)+a(45)+a(46) = s1/2 a(51)+a(52)+a(53)+a(54) = s1/2 a(59)+a(60)+a(61)+a(62) = s1/2 a(17)+a(25)+a(33)+a(41) = s1/2 a(18)+a(26)+a(34)+a(42) = s1/2 a(19)+a(27)+a(35)+a(43) = s1/2 a(20)+a(28)+a(36)+a(44) = s1/2 a(21)+a(29)+a(37)+a(45) = s1/2 a(22)+a(30)+a(38)+a(46) = s1/2 a(23)+a(31)+a(39)+a(47) = s1/2 a(24)+a(32)+a(40)+a(48) = s1/2 a( 3)+a(12)+a(21)+a(30) = s1/2 a(27)+a(20)+a(13)+a( 6) = s1/2 a(17)+a(26)+a(35)+a(44) = s1/2 a(41)+a(34)+a(27)+a(20) = s1/2 a(21)+a(30)+a(39)+a(48) = s1/2 a(45)+a(38)+a(31)+a(24) = s1/2 a(35)+a(44)+a(53)+a(62) = s1/2 a(59)+a(52)+a(45)+a(38) = s1/2

Bent Diagonals of the Sub and Middle Squares:

 a( 1)+a(10)+a(18)+a(25) = s1/2 a( 4)+a(11)+a(19)+a(28) = s1/2 a( 3)+a(12)+a(20)+a(27) = s1/2 a( 6)+a(13)+a(21)+a(30) = s1/2 a( 5)+a(14)+a(22)+a(29) = s1/2 a( 8)+a(15)+a(23)+a(32) = s1/2 a( 1)+a(10)+a(11)+a( 4) = s1/2 a(25)+a(18)+a(19)+a(28) = s1/2 a( 3)+a(12)+a(13)+a( 6) = s1/2 a(27)+a(20)+a(21)+a(30) = s1/2 a( 5)+a(14)+a(15)+a( 8) = s1/2 a(29)+a(22)+a(23)+a(32) = s1/2 a(17)+a(26)+a(34)+a(41) = s1/2 a(20)+a(27)+a(35)+a(44) = s1/2 a(19)+a(28)+a(36)+a(43) = s1/2 a(22)+a(29)+a(37)+a(46) = s1/2 a(21)+a(30)+a(38)+a(45) = s1/2 a(24)+a(31)+a(39)+a(48) = s1/2 a(17)+a(26)+a(27)+a(20) = s1/2 a(41)+a(34)+a(35)+a(44) = s1/2 a(19)+a(28)+a(29)+a(22) = s1/2 a(43)+a(36)+a(37)+a(46) = s1/2 a(21)+a(30)+a(31)+a(24) = s1/2 a(45)+a(38)+a(39)+a(48) = s1/2 a(33)+a(42)+a(50)+a(57) = s1/2 a(36)+a(43)+a(51)+a(60) = s1/2 a(35)+a(44)+a(52)+a(59) = s1/2 a(38)+a(45)+a(53)+a(62) = s1/2 a(37)+a(46)+a(54)+a(61) = s1/2 a(40)+a(47)+a(55)+a(64) = s1/2 a(33)+a(42)+a(43)+a(36) = s1/2 a(57)+a(50)+a(51)+a(60) = s1/2 a(35)+a(44)+a(45)+a(38) = s1/2 a(59)+a(52)+a(53)+a(62) = s1/2 a(37)+a(46)+a(47)+a(40) = s1/2 a(61)+a(54)+a(55)+a(64) = s1/2

The resulting number of equations can be written in the matrix representation as:

A5 * a = s

which can be reduced, by means of row and column manipulations, and results in following set of linear equations:

```a(61) =  0.5  * s1 - a(62) - a(63) - a(64)
a(59) =  0.5  * s1 - a(60) - a(61) - a(62)
a(57) =            - a(58) + a(61) + a(62)
a(56) = -0.25 * s1 + a(61) + a(62) + a(64)
a(55) =  0.25 * s1 - a(64)
a(54) =  0.25 * s1 - a(61)
a(53) =  0.25 * s1 - a(62)
a(52) = -0.25 * s1 + a(60) + a(61) + a(62)
a(51) =  0.25 * s1 - a(60)
a(50) =  0.25 * s1 + a(58) - a(61) - a(62)
a(49) =  0.25 * s1 - a(58)
a(47) = -0.25 * s1 + a(48) + a(56) + a(64)
a(46) =  0.25 * s1 - a(48) - a(56) + a(61)
a(45) =  0.5  * s1 - a(48) - a(61) - a(64)
a(44) =(-0.25 * s1 + 2 * a(48) + a(56) - 2 * a(60) + a(63) + 2 * a(64)) / 2
a(43) = -0.5  * s1 + a(44) + 2 * a(60) + a(61) + a(62)
a(42) =            - a(43) - a(58) + a(60) + a(61) + a(62)
a(41) =              a(42) + 2 * a(58) - a(61) - a(62)
a(40) =  0.5  * s1 - a(48) - a(56) - a(64)
a(39) =  0.25 * s1 - a(48)
a(38) = -0.25 * s1 + a(48) + a(61) + a(64)
a(37) =  0.5  * s1 - a(38) - a(39) - a(40)
a(36) =  0.25 * s1 + a(41) - a(58) - a(60)
a(35) =  0.5  * s1 - a(36) - a(37) - a(38)
a(34) =            - a(35) - a(58) + a(60) + a(61) + a(62)
a(33) =  0.5  * s1 - a(34) - a(35) - a(36)
a(31) =  0.25 * s1 + a(32) - a(56) - a(64)
a(30) =  0.25 * s1 - a(32) + a(56) - a(61)
a(29) =  0.5  * s1 - a(30) - a(31) - a(32)'
a(28) =(-0.25 * s1 + 2 * a(32) - a(56) + 2 * a(60) + a(61) + a(62) - a(64)) / 2
a(27) =  0.5  * s1 - a(28) - a(29) - a(30)
a(26) =            - a(28) + a(58) + a(60)
a(25) =  0.5  * s1 - a(26) - a(27) - a(28)
a(24) =            - a(32) + a(56) + a(64)
a(23) =  0.25 * s1 - a(32)
a(22) =              a(30) + 2 * a(32) - a(56) - a(64)
a(21) =  0.5  * s1 - a(22) - a(23) - a(24)
a(20) = -0.25 * s1 + a(25) + a(58) + a(60)
a(19) =  0.5  * s1 - a(20) - a(21) - a(22)
a(18) =            - a(20) + a(58) + a(60)
a(17) =  0.5  * s1 - a(18) - a(19) - a(20)
a(15) = -0.25 * s1 + a(16) + a(56) + a(64)
a(14) =  0.25 * s1 - a(16) + a(21) - a(32)
a(13) =  0.5  * s1 - a(14) - a(15) - a(16)
a(12) =  0.25 * s1 + a(16) - a(17) + a(32) - a(58) - a(60)
a(11) =  0.5  * s1 - a(12) - a(13) - a(14)
a(10) =            - a(11) - a(58) + a(60) + a(61) + a(62)
a( 9) =  0.5  * s1 - a(10) - a(11) - a(12)
a( 8) =  0.5  * s1 - a(16) - a(24) - a(32)
a( 7) =  0.5  * s1 - a(16) - a(21) - a(30)
a( 6) =  0.5  * s1 - a(13) - a(24) - a(31)
a( 5) =  0.5  * s1 - a( 6) - a( 7) - a( 8)
a( 4) =  0.5  * s1 - a(12) - a(20) - a(28)
a( 3) =  0.5  * s1 - a( 4) - a( 5) - a( 6)
a( 2) =  0.5  * s1 - a( 9) - a(20) - a(27)
a( 1) =  0.5  * s1 - a( 2) - a( 3) - a( 4)
```

Based on the equations above it can be proven that also the 4 x 4 Center Square is Magic as:

a(19) + a(28) + a(37) + a(46) = s1/2
a(22) + a(29) + a(36) + a(43) = s1/2

The solutions can be obtained by guessing a(16), a(32), a(48), a(58), a(60) and a(62) ... a(64) and filling out these guesses in the abovementioned equations.

For distinct integers also following inequalities should be applied:

0 < a(i) =< 64        for i = 1, 2 ... 15, 17 ... 31, 33 ... 47, 49 ... 57, 59, 61
Int(a(i)) = a(i)      for i = 28, 44
a(i) ≠ a(j)           for i ≠ j

With the independent variables a(64) and a(63) constant, an optimized guessing routine (MgcSqr8d2), produced 2304 Pan Magic Squares within 209 seconds, which are shown in Attachment 8.2.5.

The linear equations deducted in previous sections, have been applied in following Excel Spread Sheets:

• CnstrSngl8b1 Pan Magic Squares composed of Pan Magic Sub Squares
• CnstrSngl8b2 Pan Magic Squares composed of Pan Magic Sub Squares,
Containing Magic Middle Squares

• CnstrSngl8d1 Magic Squares composed of Magic Sub Squares,
• CnstrSngl8d2 Magic Squares composed of Magic Sub Squares,
Containing Magic Middle Squares (Bent Diagonals)

• CnstrSngl8c1 Magic Squares composed of Pan Magic Sub Squares

Only the red figures have to be “guessed” to construct one of the applicable (Pan) Magic Squares of the 8th order (wrong solutions are obvious).