14.0 Special Magic Squares, Prime Numbers
14.10 Magic Squares (13 x 13), Composed
14.10.1 Introduction
In Section 12.6
a detailed description and analysis has been provided of one of the 13^{th} order Composed Magic Squares
for distinct integers, as previously published by William Symes Andrews (1909).
It has been proven and illustrated that comparable squares, composed out of each other overlapping sub squares, can be constructed with a Pan Magic Center Square.
This section will describe how comparable squares can be constructed for prime numbers. While doing so, a number of interesting prime number based sub squares will be found and described as well.
For the sake of the analysis the 13^{th} order Magic Square, composed out of each other overlapping sub squares, will be represented as shown below. The important key variables have been highlighted in blue.
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(117) 
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) 
a(145) 
a(146) 
a(147) 
a(148) 
a(149) 
a(150) 
a(151) 
a(152) 
a(153) 
a(154) 
a(155) 
a(156) 
a(157) 
a(158) 
a(159) 
a(160) 
a(161) 
a(162) 
a(163) 
a(164) 
a(165) 
a(166) 
a(167) 
a(168) 
a(169) 
The 13^{th} order Magic Square J, with Magic Sum s1, contains following sub squares:

One 5^{th} order Pan Magic Center Square C (MC5 = 5 * s1 / 13);

One 5^{th} order Magic Corner Square G (MC5 = 5 * s1 / 13),
the element a(109) = s1 / 13 common with C;

One 3^{th} order Embedded Semi Magic Square M (MC3 = 3 * s1 / 13), eccentric in G (right top);

Four 4^{th} order Magic Border Squares (MC4 = 4 * s1 / 13): A and B (left), D and E (bottom);

Two each other overlapping 7^{th} order Magic Squares (MC7 = 7 * s1 / 13):
 I with C in the left bottom corner and
 L with C in the right top corner;

Two each other overlapping 9^{th} order Magic Squares (MC9 = 9 * s1 / 13):
 F composed out of B (left top), G (left bottom), D (right bottom) and C (right top)
 H with eccentric embedded I (left bottom)and C (left bottom).

One 11^{th} order Eccentric Magic Square K (MC11 = 11 * s1 / 13).
14.10.2 Analysis (Sub Squares)
As a consequence of the properties described in Section 14.10.1 above, the 13^{th} order Magic Square J is composed out of:

a Magic Center Square C with a Magic Sum MC5 = 5 * s1 / 13 and

72 pairs, each summing to 2 * s1 / 13, distributed over two layers, surrounding square C.
Magic Corner Square G
If the Magic Corner Square G is represented as:
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)

with Magic Sum s5, the equations defining the Magic Corner Square can be written as:
a(21) = s5  a(22)  a(23)  a(24)  a(25)
a(20) = 2 * s5/5  a(25)
a(19) = 2 * s5/5  a(24)
a(18) = 2 * s5/5  a(23)
a(17) = 2 * s5/5  a(21)
a(16) = 2 * s5/5  a(22)
a(13) = 3 * s5/5  a(14)  a(15)
a(11) = 2 * s5/5  a(12)
a(10) = 2 * s5/5  a(15)
a( 9) = 2 * s5/5  a(13)
a( 8) = 2 * s5/5  a(14)
a( 7) =(4 * s5/5  a(12)  a(13) + a(21)  a(22) + a(24)  a(25)) / 2
a( 6) = 2 * s5/5  a( 7)
a( 5) = s5/5
a( 4) = 4 * s5/5  2 * a(14)  a(15)
a( 3) = 2 * s5/5  a( 4)
a( 2) = 4 * s5/5  a( 6)  a(14)  a(15)  a(24) + a(25)
a( 1) = 2 * s5/5  a( 2)
a routine can be written to generate subject Prime Number Magic Corner Squares of order 5 (ref. PriemG5).
Attachment 14.8.5.01 shows for miscellaneous Magic Sums the first occurring Prime Number Magic Corner Square G.
Pan Magic Center Square C
Pan Magic Center Squares with Magic Sum s5 and corner element s5/5 (bottom/left), can be obtained by translation of Ultra Magic Squares.
Based on the equations for Ultra Magic Squares as deducted in Section 14.3.5, a procedure (PriemC5) can be developed:

to read the previously generated Magic Corner Squares G;

to generate Ultra Magic Squares, based on the remainder of the available pairs;

to translate the Ultra Magic Squares into the required Pan Magic Squares C.
Attachment 14.8.5.02 shows for miscellaneous Magic Sums the first occurring Prime Number Pan Magic Center Square C with corner element s5/5.
The obtained Magic Corner Squares G and related Ultra Magic Squares can be used as input for a suitable guessing routine to generate the 9^{th} order Composed Magic Squares F, which will discussed below.
Semi Magic Square M
The 3^{th} order Semi Magic Square M, embedded in the Magic Corner Square G, as mentioned in Section 14.10.1 above, is a consequence of the defining properties of the Magic Corner Square G.
Magic Border Squares A, B, D and E
If the Magic Border Square A is represented as:
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)

with Magic Sum s4, the equations defining the Magic Border Square A can be written as:
a(15) = s4/2  a(16)
a(13) = s4/2  a(14)
a(11) = s4/2  a(12)
a( 9) = s4/2  a(10)
a( 8) =(s4 + a(10)  a(12)  a(14)  a(16))/2
a( 7) = s4/2  a( 8)
a( 6) = s4/2  a( 7)  a(10) + a(12)
a( 5) = s4/2  a( 6)
a( 4) = s4/2  a( 5)  a(12) + a(14)
a( 3) = s4/2  a( 4)
a( 2) = s4  a( 4)  a(10)  a(12)
a( 1) = s4/2  a( 2)
Comparable equations can be applied for the Magic Border Squares B, D and E.
It should be noted that the Border Squares D and E
require a transposition around the axis a(4) ... a(13).
Subject equations can be incorporated in suitable guessing routines:

to generate the Composed Magic Squares F, based on the squares B and D (PriemF9);

to generate Partly Completed Squares J1, based on the squares A and E (PriemJ13);
which will be discussed below.
Magic Square F
The 9^{th} order Magic Square F is composed out of
B (left top),
G (left bottom),
D (right bottom) and
C (right top) and includes the Magic Square
L
The 4^{th} order Border Magic Squares B and D should be selected in such a way that:
a(55) + a(69) + a(83) + a(97) + a(111) + a(125) + a(139) = MC7
thus ensuring that the Sub Square L will be magic as well.
Comparable with Section 14.7.1 a procedure (PriemF9) can be developed:

to read the previously generated 5^{th} order Magic Corner Squares G;

to read the related previously generated 5^{th} order Ultra Magic Squares;

to translate the Ultra Magic Squares into the required Pan Magic Squares C;

to generate the additional 4^{th} order Magic Squares B and D, based on the remainder of the available pairs,
while ensuring that L is magic;

to complete the 9^{th} order Composed Magic Squares F.
Attachment 14.8.5.03
shows for miscellaneous Magic Sums the first occurring Prime Number Composed Magic Square F.
Magic Square L
The 7^{th} order Magic Square L is fully defined by
B (left top),
M (left bottom),
D (right bottom) and
C (right top) and is included in
F (right top) as discussed above.
Magic Squares A and E
The 4^{th} order Border Magic Squares A and E should be selected in such a way that:
a(3) + a(17) + a(129) + a(141) = MC4
thus ensuring that the Sub Square K will be magic as well.
Comparable with procedure PriemF9 as described above for Magic Square F, a procedure (PriemJ13) can be developed:

to read the previously generated 9^{th} order Magic Squares F;

to generate the additional 4^{th} order Magic Squares B and D, based on the remainder of the available pairs,
while ensuring that K is magic;

to construct intermediate 13^{th} order Partly Completed Squares J1,
composed out of F, A and E.
Attachment 14.8.5.04
shows for miscellaneous Magic Sums the first occurring Intermediate Square J1,
composed out of F, A and E.
Magic Square I
The supplementary pairs, which should be added to Square C,
to obtain the 7^{th} order Eccentric Magic Square I,
should be selected in such a way that:
a(31) + a(45) + a(101) + a(115) = MC7  a(59)  a(73)  a(87)
thus ensuring that the Square I will be magic.
Based on the above, a procedure (PriemI7) can be developed:

to read the previously generated 13^{th} order Intermediate Squares J1;

to select the supplementary pairs, which should be added to Square C,
based on the remainder of the available pairs,
while ensuring that I is magic;

to construct intermediate 13^{th} order Partly Completed Squares J2,
based on J1 completed with the supplementary pairs of I.
Attachment 14.8.5.05
shows for miscellaneous Magic Sums the first occurring Prime Number Eccentric Magic Square I
as a part of the Partly Completed Square J2.
Magic Square H
The supplementary pairs, which should be added to Square I,
to obtain the 9^{th} order Eccentric Magic Square H,
should be selected in such a way that:
a(5) + a(19) + a(103) + a(117) = MC9  a(33)  a(47)  a(61)  a(75)  a(89)
thus ensuring that the Square H will be magic.
Further it is convenient to split the supplementary rows and columns into three equal parts each summing to MC9/3.
Based on the above, a fast procedure (PriemH9) can be developed:

to read the previously generated 13^{th} order Intermediate Squares J2;

to select the supplementary pairs, which should be added to Square I,
based on the remainder of the available pairs,
while ensuring that H is magic;

to complete the 13^{th} order Composed Magic Squares J,
based on J2 completed with the supplementary pairs of H.
Attachment 14.8.5.06
shows for miscellaneous Magic Sums the first occurring
Prime Number Eccentric Magic Square H
as a part of the Completed Magic Square J.
Magic Square K
The 11^{th} order Magic Square K is fully defined by
A (left top),
L (left bottom),
E (right bottom) and
H (right top),
contains the square
I (center)
and is included in the overall square
J (right top) as discussed above.
Attachment 14.8.5.07 shows for miscellaneous Magic Sums the first occurring Prime Number Composed Magic Square K.
14.10.3 Conclusions (Completed Squares)
In previous section 13^{th} order Prime Number Magic Squares, composed out of each other overlapping sub squares, have been constructed based on:

The defining equations of the order 4 and 5 sub squares;

The construction methods for Composed Magic Squares as discussed in Section 14.7.1;

Application of an intermediate results approach.
It should be possible to find more solutions, within the range of Magic Sums as shown in Attachment 14.8.5.06, by means of:

Allowing a longer Time Out time for the applicable steps of the construction process (applied time 60 seconds);

Starting the construction process with other aspects of (or other variables for) the sub squares G and C.
Verification whether the first found solution (MC = 63171) is the smallest has been left open.
14.10.4 Associated Magic Squares (13 x 13) with Associated Square Inlays Order 6 and 7
Associated Magic Squares of order 13 with Square Inlays of order 6 and 7 can be obtained by means of a transformation of order 13 Composed Magic Squares,
as illustrated in Section 14.7.11 for order 9 Magic Squares.
MC = 87893
13499 
13421 
12503 
521 
563 
59 
12821 
4241 
3221 
3023 
599 
11411 
12011 
71 
53 
5981 
8039 
13163 
13259 
6269 
9521 
4493 
5351 
11801 
2039 
7853 
12161 
2351 
809 
10733 
2099 
12413 
1193 
6521 
12569 
11909 
7883 
6833 
419 
1109 
11423 
2789 
12713 
11171 
1361 
13103 
6689 
5639 
1613 
953 
7001 
12329 
263 
359 
5483 
7541 
13469 
13451 
5669 
11483 
1721 
8171 
9029 
4001 
7253 
13463 
12959 
13001 
1019 
101 
23 
1511 
2111 
12923 
10499 
10301 
9281 
701 
13331 
6659 
293 
13241 
6563 
479 
11969 
863 
4523 
9689 
12611 
2663 
5009 
6551 
3461 
10271 
12203 
3989 
4091 
5153 
9059 
5399 
7433 
3371 
5939 
10973 
401 
10163 
9719 
1031 
8819 
10433 
6089 
8123 
4463 
8369 
2549 
7583 
10151 
1481 
5849 
12953 
569 
7673 
12041 
3833 
8999 
12659 
1553 
8513 
10859 
911 
3089 
4703 
12491 
3803 
3359 
13121 
12641 
3671 
1259 
9473 
10781 
3329 
6173 
9431 
9533 
1319 
3251 
10061 
6971 
3593 
4349 
9173 
9929 
2153 
6761 
11369 
13043 
6959 
281 
13229 
6863 
191 
4049 
12263 
9851 
881 
7349 
10193 
2741 
The Magic Square shown above is composed out of:

One 6^{th} order Partly Compact Associated Magic Corner Square (s6 = 6 * s1 / 13),

One 7^{th} order Semi Magic Square (s7 = 7 * s1 / 13) composed of:
 One 4^{th} order Associated Magic Square (s4 = 4 * s1 / 13)
 One 3^{th} order Simple Magic Square (s3 = 3 * s1 / 13)
 Two Associated Magic Rectangles order 3 x 4,

Two Associated Magic Rectangles order 6 x 7
each with two Embedded order 3 Semi Magic Squares (s3 = 3 * s1 / 13).
Based on this definition a routine can be developed to generate subject Composed Magic Squares (ref. Priem13c).
Attachment 14.10.5 shows for miscellaneous Magic Sums the first occurring Prime Number Composed Magic Square.
Attachment 14.10.6 shows the corresponding Associated Magic Squares with order 6 and 7 Square Inlays.
It should be noted that the reversed transformation is not necessarily possible because of the bottomleft / topright Main Diagonal.
14.10.5 Composed Magic Squares (13 x 13) with Overlapping Sub Squares Order 7 and 3
An Example of an order 13 Composed Magic Square with Overlapping Sub Squares is provided below:
MC = 87893
13499 
13421 
12503 
521 
563 
59 
4241 
12239 
3803 
12821 
9521 
2549 
2153 
71 
53 
5981 
8039 
13163 
13259 
6563 
6719 
7001 
1481 
3221 
10193 
12149 
12161 
2351 
809 
10733 
2099 
12413 
6521 
6803 
6959 
1373 
3329 
10301 
12041 
1109 
11423 
2789 
12713 
11171 
1361 
9719 
1283 
9281 
11369 
10973 
4001 
701 
263 
359 
5483 
7541 
13469 
13451 
4673 
10331 
5279 
8999 
6863 
6971 
4211 
13463 
12959 
13001 
1019 
101 
23 
8849 
8243 
3191 
1973 
6869 
6653 
11549 
9743 
2909 
6311 
8081 
12659 
863 
6761 
1709 
11813 
9311 
6551 
6659 
4523 
5099 
10163 
3359 
8423 
1451 
7349 
11483 
13331 
12953 
12539 
293 
1031 
419 
5441 
7211 
10613 
3779 
6173 
12071 
2039 
479 
281 
6329 
7883 
12473 
13121 
12923 
10499 
1721 
1901 
12329 
3251 
4703 
7949 
5669 
1319 
12011 
5399 
8219 
1619 
2003 
10781 
12641 
4283 
4091 
11909 
5303 
8123 
1511 
12203 
7853 
5573 
881 
2741 
11519 
11903 
1613 
9431 
9239 
401 
1049 
5639 
7193 
13241 
13043 
11621 
11801 
3023 
599 
8819 
10271 
1193 
13103 
12491 
13229 
983 
569 
191 
The Magic Square shown above is composed out of:

Two 6^{th} order Partly Compact Associated Magic Corner Squares (s6 = 6 * s1 / 13),

Two 7^{th} order Overlapping Magic Squares (s7 = 7 * s1 / 13) each composed of:
 One 4^{th} order Associated Magic Square (s4 = 4 * s1 / 13)
 One 3^{th} order Semi Magic Square (s3 = 3 * s1 / 13)
 Two Associated Magic Rectangles order 3 x 4.
Based on this definition a routine can be developed to generate subject Composed Magic Squares (ref. Priem13d).
Attachment 14.10.7 shows for miscellaneous Magic Sums the first occurring Prime Number Composed Magic Square.
14.10.6 Summary
The obtained results regarding the 13^{th} order Prime Number Magic Squares and related sub squares, as deducted and discussed in previous sections, are summarized in following table:
