Office Applications and Entertaiment, Magic Squares Index About the Author

9.4.2 Further Analysis, Compact Associated Pan Magic Squares

The symmetry applied in the deduction on previous page was limited to the Main Diagonals.

The applicable equations for Compact Associated Pan Magic Squares, with every third-row and third-column summing to one third of the magic constant, are:

```a(79) = 123 - a(80) - a(81)
a(76) = 123 - a(77) - a(78)
a(73) = 123 - a(74) - a(75)
a(70) = 123 - a(71) - a(72)
a(69) =       a(72) + a(74) + a(75) - a(77) - 2 * a(78) + a(81)
a(68) =       a(71) - a(74) + a(80)
a(67) = 123 - a(71) - a(72) - a(75) + a(77) + 2 * a(78) - a(80) - a(81)
a(66) =       a(72) + a(74) - a(80)
a(65) =       a(71) -     2 * a(74) + 2 * a(80)
a(64) = 123 - a(71) - a(72) + a(74) - a(80)
a(63) = 123 - a(72) - a(81)
a(62) = 123 - a(71) - a(80)
a(61) =-123 + a(71) + a(72) + a(80) + a(81)
a(60) = 123 - a(72) - a(74) - a(75) + a(77) + a(78) - a(81)
a(59) = 123 - a(71) + a(74) - a(77) - a(80)
a(58) =-123 + a(71) + a(72) + a(75) - a(78) + a(80) + a(81)
a(57) = 123 - a(72) - a(74) - a(75) + a(80)
a(56) = 123 - a(71) + a(74) - 2 * a(80)
a(55) =-123 + a(71) + a(72) + a(75) + a(80)
a(54) = -82 + a(71) + a(72) - a(78) + a(80) + a(81)
a(53) = 164 - a(71) - a(77) - a(80)
a(52) =  41 - a(72) + a(77) + a(78) - 1 * a(81)
a(51) = -82 + a(71) + a(72) + a(80)
a(50) = 164 - a(71) -     2 * a(80)
a(49) =  41 - a(72) + a(80)
a(48) = -82 + a(71) + a(72) + a(75) - a(78) + a(80)
a(47) = 164 - a(71) + a(74) - a(77) - 2 * a(80)
a(46) =  41 - a(72) - a(74) - a(75) + a(77) + a(78) + a(80)
a(45) = 164 - a(71) -     2 * a(72) - a(74) - a(75) + a(77) + 2 * a(78) - a(81)
a(44) =  41 + a(74) - a(80)
a(43) = -82 + a(71) + 2 * a(72) + a(75) - a(77) - 2 * a(78) + a(80) + a(81)
a(42) = 164 - a(71) - 2 * a(72)
a(41) =  41
```
 a(40) = 82 - a(42) a(39) = 82 - a(43) a(38) = 82 - a(44) a(37) = 82 - a(45) a(36) = 82 - a(46) a(35) = 82 - a(47) a(34) = 82 - a(48) a(33) = 82 - a(49) a(32) = 82 - a(50) a(31) = 82 - a(51) a(30) = 82 - a(52) a(29) = 82 - a(53) a(28) = 82 - a(54) a(27) = 82 - a(55) a(26) = 82 - a(56) a(25) = 82 - a(57) a(24) = 82 - a(58) a(23) = 82 - a(59) a(22) = 82 - a(60) a(21) = 82 - a(61) a(20) = 82 - a(62) a(19) = 82 - a(63) a(18) = 82 - a(64) a(17) = 82 - a(65) a(16) = 82 - a(66) a(15) = 82 - a(67) a(14) = 82 - a(68) a(13) = 82 - a(69) a(12) = 82 - a(70) a(11) = 82 - a(71) a(10) = 82 - a(72) a( 9) = 82 - a(73) a( 8) = 82 - a(74) a( 7) = 82 - a(75) a( 6) = 82 - a(76) a( 5) = 82 - a(77) a( 4) = 82 - a(78) a( 3) = 82 - a(79) a( 2) = 82 - a(80) a( 1) = 82 - a(81)

which can be applied in an Excel spreadsheet (Ref. CnstrSngl9b2) and an appropriate guessing routine (MgcSqr9g).

Examples of Compact Associated Pan Magic Squares, with every third-row and third-column summing to one third of the magic constant, which can be obtained based on the equations deducted above, are shown in Attachment 9.4.4.

9.4.3 Further Analysis, Compact Pan Magic Squares

The applicable equations for Compact Pan Magic Squares are:

```a(73) = s1 - a(74) - a(75) - a(76) - a(77) - a(78) - a(79) - a(80) - a(81)
a(64) = s1 - a(65) - a(66) - a(67) - a(68) - a(69) - a(70) - a(71) - a(72)
a(61) = s1 - a(62) - a(63) - a(70) - a(71) - a(72) - a(79) - a(80) - a(81)
a(60) = s1 - a(61) - a(62) - a(69) - a(70) - a(71) - a(78) - a(79) - a(80)
a(59) = s1 - a(60) - a(61) - a(68) - a(69) - a(70) - a(77) - a(78) - a(79)
a(58) = s1 - a(59) - a(60) - a(67) - a(68) - a(69) - a(76) - a(77) - a(78)
a(57) = s1 - a(58) - a(59) - a(66) - a(67) - a(68) - a(75) - a(76) - a(77)
a(56) = s1 - a(57) - a(58) - a(65) - a(66) - a(67) - a(74) - a(75) - a(76)
a(55) = s1 - a(56) - a(57) - a(64) - a(65) - a(66) - a(73) - a(74) - a(75)
a(52) = s1 - a(53) - a(54) - a(61) - a(62) - a(63) - a(70) - a(71) - a(72)
a(51) = s1 - a(52) - a(53) - a(60) - a(61) - a(62) - a(69) - a(70) - a(71)
a(50) = s1 - a(51) - a(52) - a(59) - a(60) - a(61) - a(68) - a(69) - a(70)
a(49) = s1 - a(50) - a(51) - a(58) - a(59) - a(60) - a(67) - a(68) - a(69)
a(48) = s1 - a(49) - a(50) - a(57) - a(58) - a(59) - a(66) - a(67) - a(68)
a(47) = s1 - a(48) - a(49) - a(56) - a(57) - a(58) - a(65) - a(66) - a(67)
a(46) = s1 - a(47) - a(48) - a(55) - a(56) - a(57) - a(64) - a(65) - a(66)
a(43) = s1 - a(44) - a(45) - a(52) - a(53) - a(54) - a(61) - a(62) - a(63)
a(42) = s1 - a(43) - a(44) - a(51) - a(52) - a(53) - a(60) - a(61) - a(62)
a(41) = s1 - a(42) - a(43) - a(50) - a(51) - a(52) - a(59) - a(60) - a(61)
a(40) = s1 - a(41) - a(42) - a(49) - a(50) - a(51) - a(58) - a(59) - a(60)
a(39) = s1 - a(40) - a(41) - a(48) - a(49) - a(50) - a(57) - a(58) - a(59)
a(38) = s1 - a(39) - a(40) - a(47) - a(48) - a(49) - a(56) - a(57) - a(58)
a(37) = s1 - a(38) - a(39) - a(46) - a(47) - a(48) - a(55) - a(56) - a(57)
a(34) = s1 - a(35) - a(36) - a(43) - a(44) - a(45) - a(52) - a(53) - a(54)
a(33) = s1 - a(34) - a(35) - a(42) - a(43) - a(44) - a(51) - a(52) - a(53)
a(32) = s1 - a(33) - a(34) - a(41) - a(42) - a(43) - a(50) - a(51) - a(52)
a(31) = s1 - a(32) - a(33) - a(40) - a(41) - a(42) - a(49) - a(50) - a(51)
a(30) = s1 - a(31) - a(32) - a(39) - a(40) - a(41) - a(48) - a(49) - a(50)
a(29) = s1 - a(30) - a(31) - a(38) - a(39) - a(40) - a(47) - a(48) - a(49)
a(28) = s1 - a(29) - a(30) - a(37) - a(38) - a(39) - a(46) - a(47) - a(48)
a(27) = s1 / 3     - a(54) - a(75) - a(78) + a(81)
a(26) = s1 / 3     - a(53) - a(74) - a(77) + a(80)
a(25) = s1 - a(26) - a(27) - a(34) - a(35) - a(36) - a(43) - a(44) - a(45)
a(24) = s1 - a(25) - a(26) - a(33) - a(34) - a(35) - a(42) - a(43) - a(44)
a(23) = s1 - a(24) - a(25) - a(32) - a(33) - a(34) - a(41) - a(42) - a(43)
a(22) = s1 - a(23) - a(24) - a(31) - a(32) - a(33) - a(40) - a(41) - a(42)
a(21) = s1 - a(22) - a(23) - a(30) - a(31) - a(32) - a(39) - a(40) - a(41)
a(20) = s1 - a(21) - a(22) - a(29) - a(30) - a(31) - a(38) - a(39) - a(40)
a(19) = s1 - a(20) - a(21) - a(28) - a(29) - a(30) - a(37) - a(38) - a(39)
a(18) = s1 / 3     - a(45) - a(66) - a(69) + a(72)
a(17) = s1 / 3     - a(44) - a(65) - a(68) + a(71)
a(16) = s1 - a(17) - a(18) - a(25) - a(26) - a(27) - a(34) - a(35) - a(36)
a(15) = s1 - a(16) - a(17) - a(24) - a(25) - a(26) - a(33) - a(34) - a(35)
a(14) = s1 - a(15) - a(16) - a(23) - a(24) - a(25) - a(32) - a(33) - a(34)
a(13) = s1 - a(14) - a(15) - a(22) - a(23) - a(24) - a(31) - a(32) - a(33)
a(12) = s1 - a(13) - a(14) - a(21) - a(22) - a(23) - a(30) - a(31) - a(32)
a(11) = s1 - a(12) - a(13) - a(20) - a(21) - a(22) - a(29) - a(30) - a(31)
a(10) = s1 - a(11) - a(12) - a(19) - a(20) - a(21) - a(28) - a(29) - a(30)
a( 9) = s1 - a(17) - a(25) - a(33) - a(41) - a(49) - a(57) - a(65) - a(73)
a( 8) = s1 - a(16) - a(24) - a(32) - a(40) - a(48) - a(56) - a(64) - a(81)
a( 7) = s1 - a( 8) - a( 9) - a(16) - a(17) - a(18) - a(25) - a(26) - a(27)
a( 6) = s1 - a( 7) - a( 8) - a(15) - a(16) - a(17) - a(24) - a(25) - a(26)
a( 5) = s1 - a( 6) - a( 7) - a(14) - a(15) - a(16) - a(23) - a(24) - a(25)
a( 4) = s1 - a( 5) - a( 6) - a(13) - a(14) - a(15) - a(22) - a(23) - a(24)
a( 3) = s1 - a( 4) - a( 5) - a(12) - a(13) - a(14) - a(21) - a(22) - a(23)
a( 2) = s1 - a( 3) - a( 4) - a(11) - a(12) - a(13) - a(20) - a(21) - a(22)
a( 1) = s1 - a( 2) - a( 3) - a(10) - a(11) - a(12) - a(19) - a(20) - a(21)
```

Subject equations will be used for the generation of Sudoku Comparable Squares as discussed in Section 9.5 below,

9.4.4 Further Analysis, Partly Compact Magic Squares

Partly Compact means that, while starting with a 9th order square divided into nine 3th order sub squares, only the elements of the sub squares obtained by moving a window either horizontally or vertically will sum to the Magic Sum.

• For Compact Magic Squares the elements of 9 x 9 = 81 sub squares will sum to the Magic Sum;

• For Partly Compact Magic Squares the elements of only 3 * 9 + 3 * 6 = 45 sub squares will sum to the Magic Sum.

Although Partly Compact Magic Squares will not be considered in this section, the definition is useful to understand some of the pre selection criteria used in following sections.

9.5   More Solutions, Sudoku Comparable

9.5.1 Introduction

Any number m = 0 ... 80 can be written as m = b1 + 9 * b2 with bi = 0, 1, ... 8 for i = 1, 2.

Consequently any Magic Square M of order 9 with the numbers 1 ... 81 can be written as M = B1 + 9 * B2 + [1] where the matrices B1 and B2 contain only the integers 0, 1, ... 8.

9.5.2 Sudoku Comparable Squares

Rows, columns and 3th order sub squares of the matrices B1 and B2 containing the nine integers 0, 1, ... 8 will sum to the Magic Sum 36. Subject matrices will be further referred to as Sudoku Comparable Squares.

The well known Sudoku Puzzle, based on the integers 1, 2 ... 9, can be considered as a less strict defined 9th order Magic Square, for which only the rows, columns and sub squares sum to the Magic Sum 45, although other properties - as discussed in previous sections for 9th order Magic Squares - might occur.

Sudoku Comparable Squares can be generated by applying the deducted equations, however for a Magic Sum 36 and with the less strict restriction that only the elements of each row, column and sub square should be different.

An optimized guessing routine (SudSqr9a), based on the equations deducted in Section 9.4.2 above, produced 64 Sudoku Comparable Compact Associated Pan Magic Squares within 41,5 seconds, which are shown in Attachment 9.6.1.

9.5.3 Ternary Squares

The number of independent variables (24) for the equations deducted in Section 9.4.3 above is too high to obtain results within a reasonable time, even for the integers 0, 1 ... 8.

However if the number of integers is limited to 0, 1 and 2 under the restriction that rows, columns, main diagonals and applicable sub squares (ref. Partly Compact) contain each of these integers 3 times, a controllable collection of solutions can be obtained within a reasonable time.

Any Sudoku Comparable Square of the 9th order with the numbers 0, 1 ... 8 can be written as G1 + 3 * G2, where the matrices G1 and G2 - further referred to as Ternary Squares - contain only the numbers 0, 1 and 2.

An optimized guessing routine (Ternary9), based on the equations deducted in Section 9.4.3 above, produced 3456 Ternary Squares within 90 minutes.

Following cases have been considered (CnstrSqrs9b):

• Based on the complete collection 9216 Sudoku Comparable Squares were counted in about 18 hours, which can be used for the generation of numerous 9th order Compact Pan Magic Squares;

• The collection contains 96 Ternary Compact Associated Pan Magic Squares (ref. Attachment 9.6.8), which resulted in 1064 Sudoku Comparable Compact Associated Pan Magic Squares.

• Under the limiting condition that all 45 sub squares resulting in the Partly Compact property contain each the integers 0, 1 ... 8, 144 Sudoku Comparable Compact Pan Magic Squares could be generated (ref. Attachment 9.6.4);

• A collection of 24 Ternary Partly Compact Magic Squares could be constructed (ref. Attachment 9.6.6), which resulted under the same limiting condition in 144 Sudoku Comparable Partly Compact Magic Squares (ref. Attachment 9.6.7);

• John Hendricks constructed 24 Ternary Squares (Attachment 9.6.2), which could be used for the construction of 9th order Bimagic squares. The 24 Ternary Squares result in 432 Sudoku Comparable Squares which are shown in Attachment 9.6.3.

9.5.4 Application and Results

Numerous (Pan) Magic Squares can be generated by selecting combinations of Sudoku Comparable Squares (B1, B2) while ensuring that the resulting square M contains all integers 1 thru 81 (CnstrSqrs9a):

• Based on the collection of 1064 Sudoku Comparable Compact Associated Pan Magic Squares 48512 Compact Associated Pan Magic Squares of order 9 could be generated.

• Based on the collection of 64 Sudoku Comparable Compact Associated Pan Magic Squares (ref. Attachment 9.6.1) 1536 Compact Associated Pan Magic Squares of order 9 could be generated within 60 seconds;

• Bimagic Compact and Partly Compact Magic Squares can be generated based on the Collections:

41472 Compact and Partly Compact Magic Squares of order 9 could be generated within 42 minutes, of which 20736 Bimagic (Partly Compact).

• Based on the collection of 432 Sudoku Comparable Magic Squares (ref. Attachment 9.6.3) 31104 Bimagic Squares of order 9 could be generated within 53 minutes.

Attachment 9.6.5 shows a few examples of four Ternary squares, two related Sudoku Comparable Squares, the resulting Magic Square and the corresponding Magic Square of squared elements.