Office Applications and Entertainment, Magic Squares Index About the Author

14.0    Special Magic Squares, Prime Numbers

14.11   Magic Squares, Higher Order, Composed

14.11.1 Pan Magic Sub Squares (4 x 4)

In Section 14.6.1 was discussed how Prime Number Magic Squares of order 8 - with Magic Sum 2 * s1 - can be composed out of 4th order Prime Number Pan Magic Squares with Magic Sum s1.

Next sections show sets of Prime Number Pan Magic Squares of the 4th order, enabling the construction of 12th, 16th, 20th, 24th and 28th order Magic Squares.

14.11.2 Magic Squares (12 x 12)

An example of a Magic Sum for which a set of 9 Prime Number Pan Magic Squares can be found is 4620:

 59 181 2113 2267 2083 2297 29 211 197 43 2251 2129 2281 2099 227 13
 73 173 2131 2243 2081 2293 23 223 179 67 2237 2137 2287 2087 229 17
 167 379 1871 2203 1801 2273 97 449 439 107 2143 1931 2213 1861 509 37
 397 317 1877 2029 1637 2269 157 557 433 281 1913 1993 2153 1753 673 41
 149 683 1609 2179 1549 2239 89 743 701 131 2161 1627 2221 1567 761 71
 521 463 1657 1979 1429 2207 293 691 653 331 1789 1847 2017 1619 881 103
 523 499 1697 1901 1487 2111 313 709 613 409 1787 1811 1997 1601 823 199
 337 1021 1259 2003 1193 2069 271 1087 1051 307 1973 1289 2039 1223 1117 241
 811 827 1319 1663 929 2053 421 1217 991 647 1499 1483 1889 1093 1381 257

These 9 squares can be arranged in 9! ways, resulting in 9! * 3849 = 6,6 1028 Magic Squares of the 12th order with Magic Sum 13860.

14.11.3 Magic Squares (16 x 16)

An example of a Magic Sum for which a set of 16 Prime Number Pan Magic Squares can be found is 7980:

 83 257 3709 3931 3673 3967 47 293 281 59 3907 3733 3943 3697 317 23
 101 109 3853 3917 3823 3947 71 139 137 73 3889 3881 3919 3851 167 43
 347 271 3623 3739 3433 3929 157 461 367 251 3643 3719 3833 3529 557 61
 409 431 3547 3593 3217 3923 79 761 443 397 3581 3559 3911 3229 773 67
 433 419 3491 3637 3251 3877 193 659 499 353 3557 3571 3797 3331 739 113
 457 577 3329 3617 3083 3863 211 823 661 373 3533 3413 3779 3167 907 127
 683 953 2971 3373 2551 3793 263 1373 1019 617 3307 3037 3727 2617 1439 197
 1033 787 2903 3257 2393 3767 523 1297 1087 733 2957 3203 3467 2693 1597 223
 821 691 3079 3389 2707 3761 449 1063 911 601 3169 3299 3541 2927 1283 229
 827 1093 2689 3371 2383 3677 521 1399 1301 619 3163 2897 3469 2591 1607 313
 1153 1171 2687 2969 1997 3659 463 1861 1303 1021 2837 2819 3527 2129 1993 331
 991 1451 2267 3271 1907 3631 631 1811 1723 719 2999 2539 3359 2179 2083 359
 941 929 2797 3313 2503 3607 647 1223 1193 677 3049 3061 3343 2767 1487 383
 1433 1327 2333 2887 1709 3511 809 1951 1657 1103 2557 2663 3181 2039 2281 479
 1249 1619 2089 3023 1721 3391 881 1987 1901 967 2741 2371 3109 2003 2269 599
 1279 1381 2531 2789 2381 2939 1129 1531 1459 1201 2711 2609 2861 2459 1609 1051

These 16 squares can be arranged in 16! ways, resulting in 16! * 38416 = 4,7 1054 Magic Squares of the 16th order with Magic Sum 31920.

14.11.4 Magic Squares (20 x 20)

An example of a Magic Sum for which a set of 25 Prime Number Pan Magic Squares can be found is 13440:

 139 101 6563 6637 6491 6709 67 173 157 83 6581 6619 6653 6547 229 11
 61 353 6353 6673 6323 6703 31 383 367 47 6659 6367 6689 6337 397 17
 491 457 6043 6449 5791 6701 239 709 677 271 6229 6263 6481 6011 929 19
 251 419 6217 6553 6079 6691 113 557 503 167 6469 6301 6607 6163 641 29
 587 691 5801 6361 5483 6679 269 1009 919 359 6133 6029 6451 5711 1237 41
 653 607 5981 6199 5519 6661 191 1069 739 521 6067 6113 6529 5651 1201 59
 577 1019 5557 6287 5273 6571 293 1303 1163 433 6143 5701 6427 5417 1447 149
 733 569 5881 6257 5569 6569 421 881 839 463 5987 6151 6299 5839 1151 151
 823 977 5443 6197 5119 6521 499 1301 1277 523 5897 5743 6221 5419 1601 199
 971 1459 4973 6037 4621 6389 619 1811 1747 683 5749 5261 6101 4909 2099 331
 1097 1249 5171 5923 4721 6373 647 1699 1549 797 5623 5471 6073 5021 1999 347
 1327 1439 4831 5843 4363 6311 859 1907 1889 877 5393 5281 5861 4813 2357 409
 1423 1523 4967 5527 4217 6277 673 2273 1753 1193 5297 5197 6047 4447 2503 443
 1697 1373 4933 5437 4099 6271 863 2207 1787 1283 5023 5347 5857 4513 2621 449
 1997 1531 4481 5431 3701 6211 1217 2311 2239 1289 4723 5189 5503 4409 3019 509
 937 2153 4483 5867 4177 6173 631 2459 2237 853 5783 4567 6089 4261 2543 547
 1801 2129 4283 5227 3389 6121 907 3023 2437 1493 4919 4591 5813 3697 3331 599
 1831 2381 4297 4931 3449 5779 983 3229 2423 1789 4889 4339 5737 3491 3271 941
 2203 2081 4057 5099 3467 5689 1613 2671 2663 1621 4517 4639 5107 4049 3253 1031
 1619 2791 3917 5113 3361 5669 1063 3347 2803 1607 5101 3929 5657 3373 3359 1051
 1567 2447 4027 5399 3767 5659 1307 2707 2693 1321 5153 4273 5413 4013 2953 1061
 2857 2467 3533 4583 2609 5507 1933 3391 3187 2137 3863 4253 4787 3329 4111 1213
 2477 2383 3943 4637 3529 5051 2063 2797 2777 2083 4243 4337 4657 3923 3191 1669
 1987 3203 3461 4789 3251 4999 1777 3413 3259 1931 4733 3517 4943 3307 3469 1721
 2789 2887 3637 4127 3061 4703 2213 3463 3083 2593 3931 3833 4507 3257 3659 2017

These 25 squares can be arranged in 25! ways, resulting in 25! * 38425 = 6,3 1089 Magic Squares of the 20th order with Magic Sum 67200.

14.11.5 Magic Squares (24 x 24)

An example of a Magic Sum for which a set of 36 Prime Number Pan Magic Squares can be found is 21420 (ref. Attachment 14.7.5).

These 36 squares can be arranged in 36! ways, resulting in 36! * 38436 = 4,04 10134 Magic Squares of the 24th order with Magic Sum 128520.

14.11.6 Magic Squares (28 x 28)

An example of a Magic Sum for which a set of 49 Prime Number Pan Magic Squares can be found is 27720 (ref. Attachment 14.7.6).

These 49 squares can be arranged in 49! ways, resulting in 49! * 38449 = 2,608 10189 Magic Squares of the 28th order with Magic Sum 194040.

14.11.7 Semi Magic Sub Squares (3 x 3)

In Section 14.4.10 was discussed how Prime Number Magic Squares of order 6 - with Magic Sum 2 * s1 - can be composed out of 3th order Prime Number Semi Magic Squares with Magic Sum s1.

Next sections show sets of Prime Number Semi Magic Squares of the 3th order, enabling the construction of 9th, 12th, 15th and 18th order Magic Squares.

14.11.8 Magic Squares (9 x 9)

An example of a Magic Sum for which the required set of 1 Prime Number Magic Center Square and 8 Prime Number Semi Magic Squares can be found is 22947:

 11027 11909 11 4229 3851 14867 7691 7187 8069
 3719 11279 7949 6269 2039 14639 12959 9629 359
 8111 7607 7229 3389 4271 15287 11447 11069 431
 4019 11579 7349 5669 2339 14939 13259 9029 659
 14489 977 7481 641 7649 14657 7817 14321 809
 3191 10259 9497 8387 2081 12479 11369 10607 971
 4871 9857 8219 7127 3779 12041 10949 9311 2687
 5039 12107 5801 4691 3929 14327 13217 6911 2819
 11519 8171 3257 5987 4349 12611 5441 10427 7079

The 8 border squares can be arranged in 8! ways around the center square, resulting in 8! * 8 * 124 * 244 = 2,22 1015 Magic Squares of the 9th order with Magic Sum 68841.

Attachment 14.7.43 shows for miscellaneous Magic Sums the first occurring Prime Number Simple Magic Square composed of one Magic Center and eight Semi Magic Border Squares (7 Magic Lines).

Attachment 14.7.45 shows for miscellaneous Magic Sums the first occurring Prime Number Simple Magic Square composed of one Magic Center, four Semi Magic Corner (7 Magic Lines) and four Semi Magic Border Squares(6 Magic Lines).

Attachment 14.7.46 shows for miscellaneous Magic Sums the first occurring Prime Number Associated Magic Square composed of one Magic Center, four Semi Magic Anti Symmetric Corner and four Semi Magic Anti Symmetric Border Squares.

14.11.9 Magic Squares (12 x 12)

An example of a Magic Sum for which a set of 16 Prime Number Semi Magic Squares can be found is 16443:

 8111 8273 59 7109 641 8693 1223 7529 7691
 311 10613 5519 5399 191 10853 10733 5639 71
 349 10651 5443 5323 229 10891 10771 5563 109
 4261 5701 6481 4441 2221 9781 7741 8521 181
 659 8741 7043 6833 449 9161 8951 7253 239
 7019 8831 593 3371 3323 9749 6053 4289 6101
 4759 5521 6163 4093 2689 9661 7591 8233 619
 4831 5659 5953 3853 2731 9859 7759 8053 631
 2039 7643 6761 6173 1451 8819 8231 7349 863
 1301 10223 4919 4799 1181 10463 10343 5039 1061
 6203 9011 1229 3011 4229 9203 7229 3203 6011
 6719 3593 6131 3413 4001 9029 6311 8849 1283
 5569 6823 4051 2011 3529 10903 8863 6091 1489
 1933 8629 5881 5689 1741 9013 8821 6073 1549
 4789 6703 4951 3433 3271 9739 8221 6469 1753
 7883 5861 2699 4481 3389 8573 4079 7193 5171

These 16 squares can be arranged in 16! ways, resulting in 16! * 128 * 248 = 9,90 1032 Magic Squares of the 12th order with Magic Sum 65772.

Attachment 14.7.44 shows for miscellaneous Magic Sums the first occurring Prime Number Simple Magic Square composed of sixteen Semi Magic Sub Squares (7 Magic Lines).

The Semi Magic Sub Squares in Attachment 14.7.44 have been arranged such that the Main Square is also composed of 4 Simple Magic Squares of order 6, as discussed in Section 14.4.10.

Attachment 14.7.44a shows for miscellaneous Magic Sums the first occurring Prime Number Simple Magic Square composed of sixteen Semi Magic Sub Squares (6 and 7 Magic Lines), generated with procedure Priem3f1.

Attachment 14.7.44b shows for miscellaneous Magic Sums the first occurring Prime Number Associated Magic Square composed of sixteen Semi Magic Anti Symmetric Sub Squares, generated with procedure Priem3f2.

14.11.10 Associated Magic Squares (15 x 15)

An example of a Magic Sum for which a set of 1 Prime Number Magic Center Square and 24 Prime Number Semi Magic Squares can be found is s1 = 48561:

 16703 12821 19037 31721 9587 7253 137 26153 22271
 5861 14537 28163 13577 14591 20393 29123 19433 5
 8237 10691 29633 9521 20123 18917 30803 17747 11
 863 22307 25391 16607 8837 23117 31091 17417 53
 9677 17483 21401 16691 4967 26903 22193 26111 257
 12611 7457 28493 4937 23627 19997 31013 17477 71
 21347 21521 5693 26981 2963 18617 233 24077 24251
 9803 13217 25541 7211 18443 22907 31547 16901 113
 29027 3041 16493 2213 14747 31601 17321 30773 467
 19211 1697 27653 1523 26321 20717 27827 20543 191
 2837 20477 25247 16931 8627 23003 28793 19457 311
 11411 10007 27143 9413 18047 21101 27737 20507 317
 32027 647 15887 47 16187 32327 16487 31727 347
 32057 11867 4637 11273 14327 22961 5231 22367 20963
 32063 12917 3581 9371 23747 15443 7127 11897 29537
 32183 11831 4547 11657 6053 30851 4721 30677 13163
 31907 1601 15053 773 17627 30161 15881 29333 3347
 32261 15473 827 9467 13931 25163 6833 19157 22571
 8123 8297 32141 13757 29411 5393 26681 10853 11027
 32303 14897 1361 12377 8747 27437 3881 24917 19763
 32117 6263 10181 5471 27407 15683 10973 14891 22697
 32321 14957 1283 9257 23537 15767 6983 10067 31511
 32363 14627 1571 13457 12251 22853 2741 21683 24137
 32369 12941 3251 11981 17783 18797 4211 17837 26513
 10103 6221 32237 25121 22787 653 13337 19553 15671
 The Magic Square shown above (MC = 242805) is Associated and composed of: One Magic Center Square, Four Complementary Pairs of Semi Magic Anti Symmetric Corner Squares (7 Magic Lines) and Eight Complementary Pairs of Semi Magic Anti Symmetric Border Squares (6 Magic Lines) of order 3 with Magic Sum s1. With some minor modifications to the procedure applied in Section 14.7.10 (Priem3d3) a procedure can be obtained to generate subject Associated Composed Magic Squares (Priem3f3). Attachment 14.7.47 shows for miscellaneous Magic Sums the first occurring Prime Number Associated Magic Square composed of one Magic Center, eight Semi Magic Anti Symmetric Diagonal and sixteen Semi Magic Anti Symmetric Border Squares. 14.11.11 Associated Magic Squares (15 x 15) Alternatively Magic Squares of order 15 can be composed out of 9 Prime Number Magic Squares of order 5:
 9173 27059 27893 1721 34259 20639 14633 3911 22853 38069 28631 22811 23981 24083 599 25229 2579 31079 33179 8039 16433 33023 13241 18269 19139
 28493 38861 14969 1811 15971 29873 2789 6959 27791 32693 1709 20063 26141 39953 12239 36821 26993 13313 13229 9749 3209 11399 38723 17321 29453
 27329 32141 3881 10163 26591 8291 15671 21323 28109 26711 15761 26321 16883 6269 34871 24473 4271 20129 39761 11471 24251 21701 37889 15803 461
 809 38933 293 21851 38219 33461 34961 8849 16703 6131 26183 1049 36671 13259 22943 38153 7013 32789 8501 13649 1499 18149 21503 39791 19163
 40013 19559 719 28001 11813 491 27773 12503 39089 20249 11579 39779 20021 263 28463 19793 953 27539 12269 39551 28229 12041 39323 20483 29
 20879 251 18539 21893 38543 26393 31541 7253 33029 1889 17099 26783 3371 38993 13859 33911 23339 31193 5081 6581 1823 18191 39749 1109 39233
 39581 24239 2153 18341 15791 28571 281 19913 35771 15569 5171 33773 23159 13721 24281 13331 11933 18719 24371 31751 13451 29879 36161 7901 12713
 10589 22721 1319 28643 36833 30293 26813 26729 13049 3221 27803 89 13901 19979 38333 7349 12251 33083 37253 10169 24071 38231 25073 1181 11549
 20903 21773 26801 7019 23609 32003 6863 8963 37463 14813 39443 15959 16061 17231 11411 1973 17189 36131 25409 19403 5783 38321 12149 12983 30869
 The Prime Number Magic Square shown above (MC = 300315) is Associated and composed of: One Ultra Magic Center Square and Four Complementary Pairs of Anti Symmetric Magic Squares (ref. Section 14.3.10) of order 5 with Magic Sum s1 = 100105. The 4 independent Border Squares can be arranged in 1680 ways (= 8 * 7 * 6 * 5), which results in 1680 * 128 * n1 * n2 * n3 * n4 Magic Squares of the 16th order with Magic Sum 300315. Based on the transformations, as described in Section 3.5, ni = 32 (i = 1 ... 4) which results already in 1680 * 128 * 324 = 2,25 1011 Magic Squares which can be constructed based on the distinct integers contained in the Center Square and the 4 independent Border Squares with MC = 100105. The actual order of magnitude of ni (i = 1 ... 4) is however much higher. 14.11.12 Associated Magic Squares (18 x 18) With some minor modifications to the procedure applied in Section 14.11.9 above (Priem3f2) a procedure can be obtained to generate Associated Composed Magic Squares of order 18 (Priem3f4). Attachment 14.7.48 shows for miscellaneous Magic Sums the first occurring Prime Number Associated Magic Square composed of 12 Semi Magic Anti Symmetric Diagonal and 24 Semi Magic Anti Symmetric Border Squares. 14.11.13 Summary The obtained results regarding miscellaneous types of higher order Composed Prime Number Magic Squares as deducted and discussed in previous sections are summarized in following table:
 Type Characteristics Subroutine Results Order 9 Eight Semi Magic Border Squares One Magic Center Square Four Semi Magic Border Squares Four Semi Magic Corner Squares One Magic Center Square Four Semi Magic Anti Symmetric Border Squares Four Semi Magic Anti Symmetric Corner Squares One Magic Center Square Order 12 Sixteen Semi Magic Squares - Eight Semi Magic Diagonal Squares Eight Semi Magic Border Squares Eight Semi Magic Anti Symmetric Diagonal Squares Eight Semi Magic Anti Symmetric Border Squares Order 15 Eight Semi Magic Anti Symmetric Diagonal Squares Sixteen Semi Magic Anti Symmetric Border Squares One Magic Center Square Order 18 12 Semi Magic Anti Symmetric Diagonal Squares 24 Semi Magic Anti Symmetric Border Squares
 Comparable routines as listed above, can be used to generate miscellaneous Prime Number Inlaid Magic Squares, which will be described in following sections.