Office Applications and Entertainment, Magic Squares Index About the Author

9.7   Overlapping Sub Squares, Miscellaneous Inlays

9.7.1 Introduction

On Holger Danielsson's site I found following 9th order Composed Magic Square:

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

This 9th order Magic Square contains following Corner Squares:

• Two each 4th order Pan Magic Corner Squares A and D (MC = 164) and
• Two each 5th order Pan Magic Corner Squares B and C (MC = 205).

In Section 9.7.2 will be proven that the value of the center element a(41) = 41 for all possible Corner Squares.

Although with two 4th order Pan Magic Corner Squares, the resulting Composed Square can't be Center Symmetric, a Partly Symmetric Composed Square can be developed, which will be done in Section 9.7.3.

9.7.2 Overlapping Subsquares, General

Combination of the equations describing the 4th and 5th order Pan Magic Squares, with those describing a 9th order (Classic) Magic Square will result in following set of linear equations, defining the Composed Magic Square:

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

With an optimized guessing routine (MgcSqr9a1), based on the equations deducted above, following cases where considered:

• Case 1: All independent variables constant except a(31), a(30), a(29) and a(22), which resulted in 384 Magic Squares within 48 seconds;

• Case 2: All independent variables constant except a(81), a(80), a(79) and a(72), which resulted in 384 Magic Squares within 68 seconds;

• Case 3: All independent variables constant except a(77) ... a(74) and a(67) ... a(65), which resulted in 1152 Magic Squares within 518 seconds;

• Case 4: All independent variables constant except a(44) ... a(43) and a(36) ... a(33), which resulted in 1152 Magic Squares within 95 seconds;

Based on the cases considered above, 8 * 11522 * 3842 = 1,56 1012 Composed Magic Squares can be generated, which is only a fraction of the total possible solutions.

9.7.3 Overlapping Subsquares, Partly Symmetric

In a Center Symmetric Square, the sum of each pair of elements, which can be connected with a straight line through the center and which are equidistant to the centre, is 1 + n x n. For 9th order (Pan) Magic Squares these pairs sum to 82.

As mentioned in Section 9.7.1 above, the Composed Square can't be Center Symmetric because of the two 4th order Pan Magic Corner Squares.

However for the elements of the two 5th order Pan Magic Corner Squares, 24 pairs can be determined as described above.

This results in following additional equations:

 a( 5) + a(77) = 82 a( 6) + a(76) = 82 a( 7) + a(75) = 82 a( 8) + a(74) = 82 a( 9) + a(73) = 82 a(14) + a(68) = 82 a(15) + a(67) = 82 a(16) + a(66) = 82 a(17) + a(65) = 82 a(18) + a(64) = 82 a(23) + a(59) = 82 a(24) + a(58) = 82 a(25) + a(57) = 82 a(26) + a(56) = 82 a(27) + a(55) = 82 a(32) + a(50) = 82 a(33) + a(49) = 82 a(34) + a(48) = 82 a(35) + a(47) = 82 a(36) + a(46) = 82 a(37) + a(45) = 82 a(38) + a(44) = 82 a(39) + a(43) = 82 a(40) + a(42) = 82

which can be added to the equations deducted in Section 9.7.2 above.

The resulting square - also referred to as Partly Symmetric Composed Magic Square - is described by following set of linear equations:

```a(78) = 164 - a(79) - a(80) - a(81)
a(73) = 205 - a(74) - a(75) - a(76) - a(77)
a(71) = 164 - a(72) - a(80) - a(81)
a(70) =       a(72) - a(79) + a(81)
a(69) =     - a(72) + a(79) + a(80)
a(68) = -41 + a(74) + a(75)
a(64) = 246 - a(65) - a(66) - a(67) - a(74) - a(75)
a(63) =  82 - a(79)
a(62) = -82 + a(79) + a(80) + a(81)
a(61) =  82 - a(81)
a(60) =  82 - a(80)
a(59) =       a(65) + a(66) - a(77)
a(58) = 246 - a(66) - a(67) - a(74) - a(75) - a(76)
a(57) = 205 - a(65) - a(66) - a(67) - a(75)
a(56) = -41 + a(67) + a(75)
a(55) =-205 + a(66) + a(67) + a(74) + a(75) + a(76) + a(77)
a(54) =  82 - a(72) + a(79) - a(81)
a(53) =  82 + a(72) - a(79) - a(80)
a(52) =  82 - a(72)
a(51) = -82 + a(72) + a(80) + a(81)
a(50) = 205 - a(65) - a(66) - a(74) - a(75)
a(49) =-246 + a(66) + a(67) + a(74) + 2 * a(75) + a(76) + a(77)
a(48) =-205 + a(65) + a(66) + a(67) + a(74) + a(75) + a(76)
a(47) = 246 - a(67) - a(74) - a(75) - a(76) - a(77)
a(46) = 205 - a(66) - a(67) - a(75) - a(76)
a(45) = 328 - a(65) - a(66) - a(67) - a(74) - 2 * a(75) - a(76)
a(44) =  82 + a(65) - a(76) - a(77)
a(43) =-123 + a(66) + a(74) + a(75) + a(76)
a(42) =-123 + a(67) + a(75) + a(76) + a(77)
a(41) =  41
a(28) = 164 - a(29) - a(30) - a(31)
a(21) = 164 - a(22) - a(30) - a(31)
a(20) =       a(22) - a(29) + a(31)
a(19) =     - a(22) + a(29) + a(30)
a(13) =  82 - a(29)
a(12) = -82 + a(29) + a(30) + a(31)
a(11) =  82 - a(31)
a(10) =  82 - a(30)
a( 4) =  82 - a(22) + a(29) - a(31)
a( 3) =  82 + a(22) - a(29) - a(30)
a( 2) =  82 - a(22)
a( 1) = -82 + a(22) + a(30) + a(31)
```
 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(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(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( 9) = 82 - a(73) a( 8) = 82 - a(74) a( 7) = 82 - a(75) a( 6) = 82 - a(76) a( 5) = 82 - a(77)

With an optimized guessing routine (MgcSqr9a2), based on the equations deducted above, following cases where considered:

• Case 1: All independent variables constant except a(31), a(30), a(29) and a(22), which resulted in 384 Magic Squares within 48 seconds;

• Case 2: All independent variables constant except a(81), a(80), a(79) and a(72), which resulted in 384 Magic Squares within 68 seconds;

• Case 3: All independent variables constant except a(77) ... a(74) and a(67) ... a(65), which resulted in 2304 Magic Squares within 182 seconds of which 72 are shown in Attachment 9.7.3.

Based on the cases considered above, 8 * 3842 * 2304 = 2,72 109 Partly Symmetric Composed Magic Squares can be generated, which is only a fraction of the total possible solutions.

9.7.4 Associated Magic Squares
Associated Square Inlays Order 4 and 5

Associated Magic Squares of order 9 with Square Inlays of order 4 and 5 can be obtained by means of transformation of order 9 Composed Magic Squares as illustrated below:

 a1 a2 a3 a4 b1 b2 b3 b4 b5 a5 a6 a7 a8 b6 b7 b8 b9 b10 a9 a10 a11 a12 b11 b12 b13 b14 b15 a13 a14 a15 a16 b16 b17 b18 b19 b20 c1 c2 c3 c4 d1 d2 d3 d4 d5 c5 c6 c7 c8 d6 d7 d8 d9 d10 c9 c10 c11 c12 d11 d12 d13 d14 d15 c13 c14 c15 c16 d16 d17 d18 d19 d20 c17 c18 c19 c20 d21 d22 d23 d24 d25
= >
 d1 c1 d2 c2 d3 c3 d4 c4 d5 b1 a1 b2 a2 b3 a3 b4 a4 b5 d6 c5 d7 c6 d8 c7 d9 c8 d10 b6 a5 b7 a6 b8 a7 b9 a8 b10 d11 c9 d12 c10 d13 c11 d14 c12 d15 b11 a9 b12 a10 b13 a11 b14 a12 b15 d16 c13 d17 c14 d18 c15 d19 c16 d20 b16 a13 b17 a14 b18 a15 b19 a16 b20 d21 c17 d22 c18 d23 c19 d24 c20 d25
 The Magic Square shown at the left side above is composed out of: One 4th order Associated Magic Corner Square A with Magic Sum s4 = 164 (top/left) One 5th order Associated Magic Corner Square D with Magic Sum s5 = 205 (bottom/right) Two Associated Magic Rectangles B/C order 4 x 5 with s4 = 164 and s5 = 205 Based on this definition a routine can be developed to generate subject Composed Magic Squares (ref. Priem9f3). The total number of unique 4th order Associated Magic Corner Squares A for a(16) = 1 ... 40, 42 ... 81 is 21300, each correponding with numerous Composed Magic Squares. Attachment 9.7.4 shows for each a(16) the first occurring Composed Magic Square as described above; Attachment 9.7.5 shows the corresponding Associated Magic Squares with order 4 and 5 Square Inlays. It should be noted that the reversed transformation is not necessarily possible because of the bottom-left / top-right Main Diagonal. 9.7.5 Associated Magic Squares       Associated Center Square Order 5 Associated Magic Squares of order 9 with an Associated Center Square of order 5 can be obtained by means of transformation of order 9 Composed Magic Squares as illustrated below:
 a1 a2 a3 a4 b1 b2 b3 b4 b5 a5 a6 a7 a8 b6 b7 b8 b9 b10 a9 a10 a11 a12 b11 b12 b13 b14 b15 a13 a14 a15 a16 b16 b17 b18 b19 b20 c1 c2 c3 c4 d1 d2 d3 d4 d5 c5 c6 c7 c8 d6 d7 d8 d9 d10 c9 c10 c11 c12 d11 d12 d13 d14 d15 c13 c14 c15 c16 d16 d17 d18 d19 d20 c17 c18 c19 c20 d21 d22 d23 d24 d25
= >
 a1 a2 b1 b2 b3 b4 b5 a3 a4 a5 a6 b6 b7 b8 b9 b10 a7 a8 c1 c2 d1 d2 d3 d4 d5 c3 c4 c5 c6 d6 d7 d8 d9 d10 c7 c8 c9 c10 d11 d12 d13 d14 d15 c11 c12 c13 c14 d16 d17 d18 d19 d20 c15 c16 c17 c18 d21 d22 d23 d24 d25 c19 c20 a9 a10 b11 b12 b13 b14 b15 a11 a12 a13 a14 b16 b17 b18 b19 b20 a15 a16

Attachment 9.7.8 shows the Associated Magic Squares with order 5 Associated Center Squares, corresponding with the Composed Magic Squares as shown in Attachment 9.7.4.

It should be noted that the reversed transformation is not necessarily possible because of the bottom-left / top-right Main Diagonal.

9.7.6 Associated Magic Squares
Associated Diamond Inlays Order 4 and 5

Associated Magic Squares of order 9 with Associated Diamond Inlays of order 4 and 5

 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) a(37) a(38) a(39) a(40) a(41) a(42) a(43) a(44) a(45) a(46) a(47) a(48) a(49) a(50) a(51) a(52) a(53) a(54) a(55) a(56) a(57) a(58) a(59) a(60) a(61) a(62) a(63) a(64) a(65) a(66) a(67) a(68) a(69) a(70) a(71) a(72) a(73) a(74) a(75) a(76) a(77) a(78) a(79) a(80) a(81)

can be constructed as follows:

• Read previously generated Order 5 Associated - or Ultra Magic Diamonds with Magic Sum s5 = 205;
• Generate Order 4 Associated Magic Diamonds with Magic Sum s4 = 164;
• Complete the Order 9 Associated Magic Squares with the remaining Border Pairs.

It is convenient to split the two bottom rows and right columns into parts summing to s3 = 123 and s6 = 246, which results in following border equations:

 a9(79) = s3 - a9(80) - a9(81) a9(70) = s3 - a9(71) - a9(72) a9(63) = s3 - a9(72) - a9(81) a9(62) = s3 - a9(71) - a9(80) a9( 3) = 2 * s3/3 - a9(79) a9(12) = 2 * s3/3 - a9(70) a9(19) = 2 * s3/3 - a9(63) a9(20) = 2 * s3/3 - a9(62) a9( 1) = 2 * s3/3 - a9(81) a9( 2) = 2 * s3/3 - a9(80) a9(10) = 2 * s3/3 - a9(72) a9(11) = 2 * s3/3 - a9(71)
```a9( 4) = 2 * s9/9 - a9(78)
a9(76) =     s9   - a9( 4) - a9(13) - a9(22) - a9(31) - a9(40) - a9(49) - a9(58) - a9(67)
a9(75) =     s9   - a9( 3) - a9(12) - a9(21) - a9(30) - a9(39) - a9(48) - a9(57) - a9(66)
a9(55) =     s9   - a9(56) - a9(57) - a9(58) - a9(59) - a9(60) - a9(61) - a9(62) - a9(63)
a9(64) =     s9   - a9(65) - a9(66) - a9(67) - a9(68) - a9(69) - a9(70) - a9(71) - a9(72)
a9(74) =     s9   - a9( 2) - a9(11) - a9(20) - a9(29) - a9(38) - a9(47) - a9(56) - a9(65)
a9(73) =     s9   - a9(74) - a9(75) - a9(76) - a9(77) - a9(78) - a9(79) - a9(80) - a9(81)
a9(54) =(7 * s9 - 4 * a9(55) - 5 * a9(56) - 8 * a9(64) -  9 * a9(65) - 10 * a9(66) - 10 * a9(70)  +
- a9(74) - 2 * a9(75) - 3 * a9(76) + 12 * a9(77) -  5 * a9(78) - 10 * a9(79)) / 8
a9(46) =     s9     - a9(47) - a9(48) - a9(49) - a9(50) - a9(51) - a9(52) - a9(53) - a9(54)
```
 a9( 6) = 2 * s9/9 - a9(76) a9( 7) = 2 * s9/9 - a9(75) a9( 8) = 2 * s9/9 - a9(74) a9( 9) = 2 * s9/9 - a9(73) a9(16) = 2 * s9/9 - a9(66) a9(17) = 2 * s9/9 - a9(65) a9(18) = 2 * s9/9 - a9(64) a9(26) = 2 * s9/9 - a9(56) a9(27) = 2 * s9/9 - a9(55) a9(28) = 2 * s9/9 - a9(54) a9(36) = 2 * s9/9 - a9(46)

with a9(81), a9(80), a9(72), a9(71), a9(78), a9(66), a9(56) and a9(65) the independent variables.

Subject equations can be incorporated in a fast routine to generate the defined Associated Magic Squares (ref. Priem9f4).

Attachment 9.7.6 shows miscellaneous Associated Magic Squares with order 4 and 5 Diamond Inlays.

An alternative method to generate Associated Magic Squares with order 4 and 5 Diamond Inlays will be discussed in Section 18.4.2.

9.7.7 Associated Magic Squares
Square Inlays Order 3 and 4 (Overlapping)

The 9th order Associated Inlaid Magic Square shown below:

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

contains following inlays:

• two each 4th order Simple Magic Squares - Magic Sums s(1) = 134 and s(4) = 194 - with the center element in common,
• two each 3th order Simple Magic Squares with Magic Sums s(2) = 147 and s(3) = 99.

The relation between the Magic Sums s(1), s(2), s(3) and s(4) is:

```s(1) = 8 * s9 / 9 - s(4)
s(2) = 6 * s9 / 9 - s(3)
```

With s9 = 369 the Magic Sum of the 9th order Inlaid Magic Square.

The Associated Border can be described by following linear equations:

```a(76) =    - s9 / 9 + a(78) - s(3) + s(4)
a(75) =    - s9 / 9 + a(79) - s(3) + s(4)
a(73) = 12 * s9 / 9 - a(77) - 2 * a(78) - 2 * a(79) - 2 * a(80) - a(81) + 3 * s(3) - 3 * s(4)
a(64) =      s9     - a(72) - s(3) - s(4)
a(55) =      s9     - a(63) - s(3) - s(4)
a(46) =      s9     - a(54) - s(3) - s(4)
a(45) = 40 * s9 / 9 - 2*a(54) - 2*a(63) - 2*a(72) - a(77) - 2*a(78) - 2*a(79) - 2*a(80) - 2*a(81) - 6*s(4)
```
 a(37) = 2 * s9 / 9 - a(45) a(36) = 2 * s9 / 9 - a(46) a(28) = 2 * s9 / 9 - a(54) a(27) = 2 * s9 / 9 - a(55) a(19) = 2 * s9 / 9 - a(63) a(18) = 2 * s9 / 9 - a(64) a(10) = 2 * s9 / 9 - a(72) a( 9) = 2 * s9 / 9 - a(73) a( 8) = 2 * s9 / 9 - a(74) a( 7) = 2 * s9 / 9 - a(75) a(6) = 2 * s9 / 9 - a(76) a(5) = 2 * s9 / 9 - a(77) a(4) = 2 * s9 / 9 - a(78) a(3) = 2 * s9 / 9 - a(79) a(2) = 2 * s9 / 9 - a(80) a(1) = 2 * s9 / 9 - a(81)

Which can be incorporated in an optimised guessing routine MgcSqr9k, together with the defining equations of the 3th and 4th order inlays.

Attachment 9.7.7 shows a few 9th order Inlaid Magic Squares for miscellaneous possible Magic Sums s(3) and s(4).

Each square shown corresponds with numerous solutions, which can be obtained by variation of the four inlays and the border.