Office Applications and Entertainment, Magic Squares Index About the Author

 14.0    Special Magic Squares, Prime Numbers 14.21   Magic Squares, Higher Order, Inlaid (1) 14.21.1 Magic Squares (8 x 8) Examples of Prime Number Inlaid Magic Squares of order 8, with four 3th order Embedded Semi Magic Squares of the same Magic Sum and corresponding Border, are shown in: Attachment 14.6.26, Composed Center Square Attachment 14.6.27, Composed Center Square, Associated Prime Number Inlaid Magic Squares of order 8, with four 3th order Embedded Magic Squares with different Magic Sums and an Associated Border, have been described in Section 14.6.12. Examples of such Prime Number Inlaid Magic Squares of order 8 are shown in Attachment 14.6.40. 14.21.2 Magic Squares (9 x 9) Examples of Prime Number Magic Squares of order 9, composed out of eight Prime Number Semi Magic Squares and one Magic Center Square of order 3 with the same Magic Sum, have been discussed in Section 14.11.8. The 9th order Prime Number Inlaid Magic Square shown below (s9 = 34227), is composed out of nine each 3th order Simple Magic Squares with different Magic Sums s(1) ... s(9).
 7919 449 4049 269 4139 8009 4229 7829 359
 7187 311 3533 23 3677 7331 3821 7043 167
 7013 239 3527 107 3593 7079 3659 6947 173
 6197 383 3191 251 3257 6263 3323 6131 317
 6173 2819 2417 47 3803 7559 5189 4787 1433
 7877 881 4289 761 4349 7937 4409 7817 821
 6803 2213 3023 233 4013 7793 5003 5813 1223
 6599 1571 3617 947 3929 6911 4241 6287 1259
 6257 1283 2861 71 3467 6863 4073 5651 677

The Magic Sums s(1) thru s(9) of the Magic Sub Squares comply with the equations defining a Magic Square of order 3 (ref. Section 14.1.1).

The Prime Number Inlaid Magic Square shown above can be constructed by selecting:

• An order 3 Magic Main Square containing possible Center Elements for the Sub Squares
• Nine order 3 Magic Sub Squares based on the corresponding Magic Sums (ref. Priem9k)

Attachment 14.6.54 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 9.

Each square shown corresponds with numerous solutions, which can be obtained by rotation/reflection of the main square or the nine inlays (8 * 89 = 1,07 109).

Prime Number Inlaid Magic Squares of order 9, with following inlays:

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

and an Associated Border, have been described in Section 14.7.15.

Examples of such Prime Number Inlaid Magic Squares of order 9 are shown in Attachment 14.7.21.

14.21.3 Magic Squares (10 x 10)

Examples of Prime Number Inlaid Magic Squares of order 10, with four 4th order Embedded (Pan) Magic Squares of the same Magic Sum and corresponding Border, are shown in:

The 10th order Inlaid Magic Square shown below, is composed out of an Associated Border and four each 4th order Embedded (Pan) Magic Squares with different Magic Sums s(1), s(2), s(3) and s(4).

 a(1) a(2) a(3) a(4) a(5) a(6) a(7) a(8) a(9) a(10) a(11) a(12) a13) 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) a(82) a(83) a(84) a(85) a(86) a(87) a(88) a(89) a(90) a(91) a(92) a(93) a(94) a(95) a(96) a(97) a(98) a(99) a(100)

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

```s(1) = 4 * s10 / 5 - s(4)
s(2) = 4 * s10 / 5 - s(3)
```

With s10 the Magic Sum of the 10th order Inlaid Magic Square.

Based on the equations describing the Associated Border:

```a(95) =           a(96) - s(3) + s(4)
a(94) =           a(97) - s(3) + s(4)
a(93) =           a(98) - s(3) + s(4)
a(92) =           a(99) - s(3) + s(4)
a(91) =   s10 - 2*a(96) - 2 * a(97) - 2 * a(98) - 2 * a(99) - a(100) + 4 * s(3) - 4 * s(4)
a(81) =   s10   - a(90) - s(3) - s(4)
a(71) =   s10   - a(80) - s(3) - s(4)
a(61) =   s10   - a(70) - s(3) - s(4)
a(60) = 5*s10/2 - a(70) - a(80) - a(90) - a(96) - a(97) - a(98) - a(99) - a(100) - 4 * s(4)
a(51) =   s10   - a(60) - s(3) - s(4)
```
 a(50) = s10/5 - a(51) a(41) = s10/5 - a(60) a(40) = s10/5 - a(61) a(31) = s10/5 - a(70) a(30) = s10/5 - a(71) a(21) = s10/5 - a(80) a(20) = s10/5 - a(81) a(11) = s10/5 - a(90) a(10) = s10/5 - a(91) a( 9) = s10/5 - a(92) a( 8) = s10/5 - a(93) a( 7) = s10/5 - a(94) a( 6) = s10/5 - a(95) a(5) = s10/5 - a( 96) a(4) = s10/5 - a( 97) a(3) = s10/5 - a( 98) a(2) = s10/5 - a( 99) a(1) = s10/5 - a(100)

a procedure can be developed:

• to collect previously generated (Pan) Magic Squares of the fourth order (ref. Section 14.2.2) and
• to complete subject 10th order Prime Number Inlaid Magic Squares (ref. Priem10k).

Attachment 14.6.42 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 10.

More unique solutions per Magic Sum s10 are possible, by variation of the type (Associated, Pan Magic, Simple) or the Magic Sums s(1) ... s(4) of the Embedded Magic Squares.

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

14.21.4 Magic Squares, Bordered (12 x 12)

Prime Number Inlaid Magic Squares of order 12, with four 5th order Embedded Magic Squares of the same Magic Sum and corresponding Border, can be constructed with a procedure (Priem12a) which:

• reads previously generated 10th order Composed (Associated) Magic Squares (ref. Attachment 14.8.66) and
• completes the 12th order Prime Number Inlaid Magic Squares with a suitable border.

Attachment 14.6.51 shows for miscellaneous Magic Sums subject Prime Number Inlaid Magic Squares of order 12.

The 12th order Inlaid Magic Square shown below, is composed out of an Associated Border and four each 5th order Embedded (Ultra) Magic Squares with different Magic Sums s(1), s(2), s(3) and s(4).

 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) a(82) a(83) a(84) a(85) a(86) a(87) a(88) a(89) a(90) a(91) a(92) a(93) a(94) a(95) a(96) a(97) a(98) a(99) a(100) a(101) a(102) a(103) a(104) a(105) a(106) a(107) a(108) a(109) a(110) a(111) a(112) a(113) a(114) a(115) a(116) a(117) a(118) a(119) a(120) a(121) a(122) a(123) a(124) a(125) a(126) a(127) a(128) a(129) a(130) a(131) a(132) a(133) a(134) a(135) a(136) a(137) a(138) a(139) a(140) a(141) a(142) a(143) a(144)

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

```s(1) = 5 * s12 / 6 - s(4)
s(2) = 5 * s12 / 6 - s(3)
```

With s12 the Magic Sum of the 12th order Inlaid Magic Square.

Based on the equations describing the Associated Border:

```a(138) =           a(139) - s(3) + s(4)
a(137) =           a(140) - s(3) + s(4)
a(136) =           a(141) - s(3) + s(4)
a(135) =           a(142) - s(3) + s(4)
a(134) =           a(143) - s(3) + s(4)
a(133) =   s12 - 2*a(139) - 2*a(140) - 2*a(141) - 2*a(142) - 2*a(143) - a(144) + 5*s(3) - 5*s(4)
a(121) =   s12 -   a(132) - s(3) - s(4)
a(109) =   s12 -   a(120) - s(3) - s(4)
a( 97) =   s12 -   a(108) - s(3) - s(4)
a( 85) =   s12 -   a( 96) - s(3) - s(4)
a( 84) = 3*s12 -   a( 96) - a(108) - a(120) - a(132) - a(139) - a(140) - a(141) +
- a(142) - a(143) - a(144) - 5*s(4)
a( 73) =   s12 -   a( 84) - s(3) - s(4)
```
 a(72) = s12/6 - a(73) a(61) = s12/6 - a(84) a(60) = s12/6 - a(85) a(49) = s12/6 - a(96) a(48) = s12/6 - a(97) a(37) = s12/6 - a(108) a(36) = s12/6 - a(109) a(25) = s12/6 - a(120) a(24) = s12/6 - a(121) a(13) = s12/6 - a(132) a(12) = s12/6 - a(133) a(11) = s12/6 - a(134) a(10) = s12/6 - a(135) a( 9) = s12/6 - a(136) a( 8) = s12/6 - a(137) a( 7) = s12/6 - a(138) a(6) = s12/6 - a(139) a(5) = s12/6 - a(140) a(4) = s12/6 - a(141) a(3) = s12/6 - a(142) a(2) = s12/6 - a(143) a(1) = s12/6 - a(144)

a procedure can be developed:

• to collect previously generated (Ultra) Magic Squares of the fifth order (ref. Section 14.3.5) and
• to complete subject 12th order Prime Number Inlaid Magic Squares (ref. Priem12k).

Attachment 14.6.50 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 12.

More unique solutions per Magic Sum s12 are possible, by variation of the type (Associated, Pan Magic, Simple) or the Magic Sums s(1) ... s(4) of the Embedded Magic Squares.

Attachment 14.6.52 contains a few additional Prime Number Inlaid Magic Square of order 12 based on:

• Embedded Concentric Magic Sub Squares                     (ref. Section 14.3.2)
• Embedded Associated Magic Sub Squares with Diamond Inlay  (ref. Section 14.3.6)

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

14.21.5 Magic Squares, Composed (12 x 12)

An example of a Prime Number Magic Square of order 12, composed out of 9 Prime Number Pan Magic Squares of order 4 with the same Magic Sum, has been provided in Section 14.11.2.

The 12th order Inlaid Magic Square shown below (s12 = 33468), is composed out of nine each 4th order Pan Magic Squares with different Magic Sums s(1) ... s(9).

 557 1721 4091 5507 3671 5927 137 2141 1847 431 5381 4217 5801 3797 2267 11
 383 821 4643 5261 4373 5531 113 1091 911 293 5171 4733 5441 4463 1181 23
 449 1013 4049 4973 3833 5189 233 1229 1193 269 4793 4229 5009 4013 1409 53
 461 1163 3659 4481 3389 4751 191 1433 1223 401 4421 3719 4691 3449 1493 131
 761 1877 3581 4937 2999 5519 179 2459 1997 641 4817 3701 5399 3119 2579 59
 701 887 5303 5657 4703 6257 101 1487 971 617 5573 5387 6173 4787 1571 17
 827 1913 3851 5237 3221 5867 197 2543 2063 677 5087 4001 5717 3371 2693 47
 1151 2393 3011 4649 2741 4919 881 2663 2591 953 4451 3209 4721 2939 2861 683
 1439 2309 2777 3911 2399 4289 1061 2687 2441 1307 3779 2909 4157 2531 2819 929
 The Magic Sums s(1) thru s(9) of the Pan Magic Sub Squares comply with the equations defining a Magic Square of order 3 (ref. Section 14.1.1). The Prime Number Inlaid Magic Square shown above can be constructed by selecting: An order 3 Magic Main Square containing possible Order 4 Magic Sums Nine order 4 Pan Magic Sub Squares based on these Magic Sums and the equations deducted in Section 14.2.2 Attachment 14.6.55 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 12. Each square shown corresponds with numerous solutions, which can be obtained by rotation/reflection of the main square or selecting other aspects of the nine inlays (8 * 3849 = 1,45 1024). Alternatively Order 12 Prime Number Inlaid Magic Squares can be constructed by selecting: An order 4 Pan Magic Main Square containing possible Center Elements for the Sub Squares Sixteen order 3 Magic Sub Squares based on the corresponding Magic Sums (ref. Priem12c) Attachment 14.6.56 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 12. Each square shown corresponds with numerous solutions, which can be obtained by selecting other aspects of the main square or rotation/reflection of the sixteen inlays (384 * 812 = 2,64 1013). 14.21.6 Magic Squares, Composed (15 x 15) An example of an Associated Prime Number Magic Square of order 15, composed out of 9 Prime Number Magic Squares of order 5 with the same Magic Sum, has been provided in Section 14.11.11. The 15th order Inlaid Magic Square shown below (s15 = 285015), is composed out of nine each 5th order Ultra Magic Squares with different Magic Sums s(1) ... s(9).
 41189 13043 15053 31481 3089 8081 24509 17789 25733 27743 2333 40433 20771 1109 39209 13799 15809 23753 17033 33461 38453 10061 26489 28499 353
 34439 13469 5279 26297 8111 4649 25667 12791 26339 18149 4691 31019 17519 4019 30347 16889 8699 22247 9371 30389 26927 8741 29759 21569 599
 36923 16673 4493 21419 14057 2543 19469 18047 32843 20663 13967 36833 18713 593 23459 16763 4583 19379 17957 34883 23369 16007 32933 20753 503
 32303 11273 11159 25523 4457 7253 21617 14033 20963 20849 2693 30539 16943 3347 31193 13037 12923 19853 12269 26633 29429 8363 22727 22613 1583
 36809 18743 1613 22901 14939 1451 22739 15359 36293 19163 14843 36713 19001 1289 23159 18839 1709 22643 15263 36551 23063 15101 36389 19259 1193
 42101 12107 16319 27239 7529 8969 19889 23831 24197 28409 5927 40499 21059 1619 36191 13709 17921 18287 22229 33149 34589 14879 25799 30011 17
 38189 14669 8837 30509 4241 5009 26681 12689 28949 23117 3449 37397 19289 1181 35129 15461 9629 25889 11897 33569 34337 8069 29741 23909 389
 40853 12323 10499 31793 6947 8273 29567 17333 24533 22709 1013 34919 20483 6047 39953 18257 16433 23633 11399 32693 34019 9173 30467 28643 113
 32939 12941 6983 28619 4673 5813 27449 10133 24359 18401 1553 29819 17231 4643 32909 16061 10103 24329 7013 28649 29789 5843 27479 21521 1523
 The Magic Sums s(1) thru s(9) of the Concentric Magic Sub Squares comply with the equations defining a Magic Square of order 3 (ref. Section 14.1.1). The Prime Number Inlaid Magic Square shown above can be constructed by selecting: An order 3 Magic Main Square containing possible Center Elements for the Sub Squares Nine order 5 Ultra Magic Sub Squares based on the corresponding Magic Sums and the equations deducted in Section 14.3.5 Attachment 14.6.53 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 15, composed of: Ultra      Magic Sub Squares                     (ref. Section 14.3.5) Concentric Magic Sub Squares                     (ref. Section 14.3.2) Associated Magic Sub Squares with Diamond Inlay  (ref. Section 14.3.6) Each square shown corresponds with numerous solutions, which can be obtained by rotation/reflection of the main square or selecting other aspects of the nine inlays. Alternatively Order 15 Prime Number Inlaid Magic Squares can be constructed by selecting: An order 5 Symmetric Magic Main Square containing possible Center Elements for Order 3 Sub Squares Twenty five order 3 Simple Magic Sub Squares based on the corresponding Magic Sums (ref. Priem15k4) Attachment 14.6.57 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 15, based on Associated Main Squares with Diamond Inlay. Each square shown corresponds with numerous solutions, which can be obtained by selecting other aspects of the main square or rotation/reflection of the twenty five inlays. 14.21.7 Magic Squares, Composed (16 x 16) An example of a Prime Number Magic Square of order 16, composed out of 16 Prime Number Pan Magic Squares of order 4 with the same Magic Sum, has been provided in Section 14.11.3. The 16th order Inlaid Magic Square shown below (s16 = 63840), is composed out of sixteen each 4th order Pan Magic Squares with different Magic Sums s(1) ... s(16).
 359 947 6653 7253 6317 7589 23 1283 953 353 7247 6659 7583 6323 1289 17
 823 1531 6067 6967 5347 7687 103 2251 1627 727 6871 6163 7591 5443 2347 7
 691 457 7489 7759 7069 8179 271 877 709 439 7507 7741 7927 7321 1129 19
 599 1523 6803 7919 6353 8369 149 1973 1619 503 7823 6899 8273 6449 2069 53
 1321 1993 5737 7177 4813 8101 397 2917 2377 937 6793 6121 7717 5197 3301 13
 677 2999 5297 8039 4889 8447 269 3407 3209 467 7829 5507 8237 5099 3617 59
 443 1031 6359 7211 6089 7481 173 1301 1163 311 7079 6491 7349 6221 1433 41
 571 1087 6661 7237 6199 7699 109 1549 1117 541 7207 6691 7669 6229 1579 79
 1373 1709 5861 6581 4751 7691 263 2819 1901 1181 6389 6053 7499 4943 3011 71
 1237 1009 6211 6619 5521 7309 547 1699 1327 919 6301 6529 6991 5839 2017 229
 1471 1297 6607 7333 5623 8317 487 2281 1747 1021 6883 7057 7867 6073 2731 37
 593 3257 4799 7883 4463 8219 257 3593 3467 383 7673 5009 8009 4673 3803 47
 2617 2689 5119 6451 3259 8311 757 4549 3319 1987 5821 5749 7681 3889 5179 127
 1613 2399 5393 6959 4259 8093 479 3533 2789 1223 6569 5783 7703 4649 3923 89
 2273 2609 5003 5807 2969 7841 239 4643 2843 2039 5573 5237 7607 3203 4877 5
 1663 2221 4663 6361 3631 7393 631 3253 2791 1093 5791 5233 6823 4201 3823 61
 The Magic Sums s(1) thru s(16) of the Pan Magic Sub Squares comply with the equations defining a Pan Magic Square of order 4 (ref. Section 14.2.2). The Prime Number Inlaid Magic Square shown above can be constructed by selecting: An order 4 Pan Magic Main Square containing possible Order 4 Magic Sums Sixteen order 4 Pan Magic Sub Squares based on these Magic Sums and the equations deducted in Section 14.2.2 Attachment 14.6.70 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 16. Each square shown corresponds with numerous solutions, which can be obtained by selecting other aspects of the main square or the sixteen inlays (384 * 38416 = 8,58 1043). 14.21.8 Magic Squares, Composed (20 x 20) An example of a Prime Number Magic Square of order 20, composed out of 25 Prime Number Pan Magic Squares of order 4 with the same Magic Sum, has been provided in Section 14.11.4. Examples of 20th order Inlaid Magic Squares, composed out of twenty five each 4th order Pan Magic Squares with different Magic Sums s(1) ... s(25), are shown in Attachment 14.6.82. The Magic Sums s(1) thru s(25) of the Pan Magic Sub Squares comply with the equations defining an Associated Magic Square of order 5 with Diamond Inlay (ref. Section 14.3.6). The Prime Number Inlaid Magic Squares described above can be constructed by selecting: An order 5 Magic Main Square containing possible Order 4 Magic Sums Twenty five order 4 Pan Magic Sub Squares based on these Magic Sums and the equations deducted in Section 14.2.2 Attachment 14.6.82 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 20, based on Associated Main Squares with Diamond Inlay. Each square shown corresponds with numerous solutions, which can be obtained by selecting other aspects of the main square or the twentfive inlays. Alternatively Order 20 Prime Number Inlaid Magic Squares can be constructed by selecting: An order 4 Pan Magic Main Square containing possible Center Elements for the Sub Squares Sixteen order 5 Magic Sub Squares based on the corresponding Magic Sums and the equations deducted in Section 14.3.6 Attachment 14.6.81 shows for a few Magic Sums the first occurring Prime Number Inlaid Magic Square of order 20. Each square shown corresponds with numerous solutions, which can be obtained by selecting other aspects of the main square or the sixteen inlays. 14.21.9 Magic Squares, Composed (25 x 25) Attachment 14.6.90 shows an example of a 25th order Inlaid Magic Square, composed out of twenty five each 5th order Magic Squares with different Magic Sums s(1) ... s(25). The Magic Sums s(1) thru s(25) of the Magic Sub Squares comply with the equations defining an Associated Magic Square of order 5 with Diamond Inlay (ref. Section 14.3.6). The Prime Number Inlaid Magic Square described above can be constructed by selecting: An order 5 Magic Main Square containing possible Center Elements for the Sub Squares Twenty five order 5 Magic Sub Squares based on the corresponding Magic Sums and the equations deducted in Section 14.3.6 The square shown corresponds with numerous solutions, which can be obtained by selecting other aspects of the main square or the twenty five inlays. 14.21.10 Summary The obtained results regarding miscellaneous types of higher order Prime Number Inlaid Magic Squares as deducted and discussed in previous sections are summarized in following table:
 Type Characteristics Subroutine Results Order 9 Sub Squares Order 3, with Different Magic Sums Order 10 Sub Squares Order 4, with Different Magic Sums Order 12 Sub Squares Order 5, with Identical Magic Sum Sub Squares Order 5, with Different Magic Sums                      Miscellaneous Inlays Order 12 Sub Squares Order 4, with Different Magic Sums Sub Squares Order 3, with Different Magic Sums Order 15 Sub Squares Order 5, with Different Magic Sums Sub Squares Order 3, with Different Magic Sums Order 16 Sub Squares Order 4, with Different Magic Sums Order 20 Sub Squares Order 5, with Different Magic Sums Sub Squares Order 4, with Different Magic Sums Order 25 Sub Squares Order 5, with Different Magic Sums - - - -
 Following sections will describe how Inlaid Magic Squares with Concentric Main and/or Sub Squares can be generated with comparable routines as described in previous sections.