14.0 Special Magic Squares, Prime Numbers
14.13 Consecutive Primes (1)
Prime Number Magic Squares with Consecutive Primes can be generated with comparable routines as described in Section 14, however based on
consecutive prime variable values {ai} with i = 1 ... n.
14.13.1 Magic Squares (4 x 4)
Based on the equations defining a Magic Square of the fourth order:
a(13) = s1 - a(14) - a(15) - a(16)
a( 9) = s1 - a(10) - a(11) - a(12)
a( 7) = a( 8) - a(10) + a(12) - a(13) + a(16)
a( 6) = s1 - a( 8) - a(11) - a(12) + a(13) - a(16)
a( 5) = - a( 8) + a(10) + a(11)
a( 4) = s1 - a( 7) - a(10) - a(13)
a( 3) = -s1 - a( 8) + a( 9) + 2 * a(10) + 2 * a(13) + a(14)
a( 2) = a( 8) - a( 9) - 2 * a(10) + a(15) + 2 * a(16)
a( 1) = a( 8) + a(12) - a(13)
and preselected ranges of consecutive primes, routine Priem4b2 can be used to generate order 4
Prime Number Magic Squares with Consecutive Prime Numbers.
Prime Number Magic Squares with Consecutive Prime Numbers for MC = 258 (32 ea) and MC = 276 (64 ea)
were already found by means of routine Priem4 and shown in Attachment 14.2.1.
Attachment 14.13.1 shows for a few higher Magic Sums the first occurring Prime Number Magic Square with Consecutive Prime Numbers.
Each square shown corresponds with numerous Prime Number Magic Squares with the same Magic Sum and variable values.
14.13.2 Magic Squares (5 x 5)
Based on the equations defining a Magic Square of the fifth order:
a(21) = s1 - a(22) - a(23) - a(24) - a(25)
a(16) = s1 - a(17) - a(18) - a(19) - a(20)
a(11) = s1 - a(12) - a(13) - a(14) - a(15)
a( 9) = a(10) - a(13) + a(15) - a(17) + a(20) - a(21) + a(25)
a( 7) = (s1 - a( 8) - a( 9) - a(10) + a(11) - a(13) + a(16) - a(19) + a(21) - a(25))/2
a( 6) = s1 - a( 7) - a( 8) - a( 9) - a(10)
a( 5) = s1 - a( 9) - a(13) - a(17) - a(21)
a( 4) = s1 - a( 9) - a(14) - a(19) - a(24)
a( 3) = s1 - a( 8) - a(13) - a(18) - a(23)
a( 2) = s1 - a( 7) - a(12) - a(17) - a(22)
a( 1) = s1 - a( 2) - a( 3) - a( 4) - a( 5)
and preselected ranges of consecutive primes, routine Priem5b2 can be used to generate order 5
Prime Number Magic Squares with Consecutive Prime Numbers.
Attachment 14.13.2
shows for miscellaneous Magic Sums the first occurring Prime Number Magic Square with Consecutive Prime Numbers.
Each square shown corresponds with numerous Prime Number Magic Squares with the same Magic Sum and variable values.
One of the possible aspects of the square with the smallest Magic Sum (MC = 313)
was previously published by Max Alekseyey (2009).
14.13.3 Pan Magic Squares (6 x 6)
Based on the equations defining a Pan Magic Square of the sixth order:
a(31) = s1 - a(32) - a(33) - a(34) - a(35) - a(36)
a(25) = s1 - a(26) - a(27) - a(28) - a(29) - a(30)
a(19) = s1 - a(20) - a(21) - a(22) - a(23) - a(24)
a(17) = 2/3 * s1 - a(18) + a(20) + a(21) - a(23) - a(24) + a(26) + a(27) - a(29) - a(30) - a(35) - a(36)
a(16) = 2 * s1 + a(18) - a(20) - 2*a(21) - 2*a(22) - a(23) - a(26) - 2*a(27) - 2*a(28) - a(29) - a(34) + a(36)
a(15) = 2/3 * s1 - a(18) - a(33) - a(36)
a(14) = a(18) - a(20) - a(21) + a(23) + a(24) - a(26) - a(27) + a(29) + a(30) - a(32) + a(36)
a(13) = -4/3 * s1 - a(18) + a(20) + 2*a(21) + 2*a(22) + a(23) + a(26) + 2*a(27) + 2*a(28) + a(29) - a(31) - a(36)
a(12) = 11/6 * s1 - a(20) - a(21) - a(22) - a(26) - 2*a(27) - a(28) - a(32) - a(33) - a(34)
a(11) = -7/6 * s1 + a(22) + a(23) + a(24) - a(26) + a(28) + a(29) + a(30) + a(34) + a(35) + a(36)
a(10) = -7/6 * s1 + a(21) + a(22) + a(23) - a(25) + a(27) + a(28) + a(29) + a(33) + a(34) + a(35)
a(9) = -7/6 * s1 + a(20) + a(21) + a(22) + a(26) + a(27) + a(28) - a(30) + a(32) + a(33) + a(34)
a(8) = 11/6 * s1 - a(22) - a(23) - a(24) - a(28) - 2*a(29) - a(30) - a(34) - a(35)-a(36)
a(7) = 11/6 * s1 - a(21) - a(22) - a(23) - a(27) - 2*a(28) - a(29) - a(33) - a(34)-a(35)
a(6) = -5/6 * s1 - a(18) + a(20) + a(21) + a(22) - a(24) + a(26) + 2*a(27) + a(28)-a(30)+a(32)+a(33)+a(34)-a(36)
a(5) = 1/2 * s1 + a(18) + a(19) + a(24) - a(27) - a(28) - a(29) - a(34) - a(35)
a(4) = 1/6 * s1 - a(18) + a(20) + a(21) - a(28) - a(29) - a(30) + a(31) + a(32)
a(3) = 1/2 * s1 + a(18) - a(20) - 2*a(21) - a(22) - a(26) - 2*a(27) - a(28) + a(30) + a(31) + a(35) + 2*a(36)
a(2) = 1/6 * s1 - a(18) + a(21) + a(22) - a(25) - a(26) - a(30) + a(34) + a(35)
a(1) = 1/2 * s1 + a(18) + a(23) + a(24) - a(25) - a(26) - a(27) - a(31) - a(32)
and preselected ranges of consecutive primes, routine Priem6b1 can be used to generate order 6
Prime Number Magic Squares with Consecutive Prime Numbers.
Although the first range of 36 Consecutive Primes with a valid Magic Sum MC6 = 930 can be determined,
subject routine is not very feasible due to the high number of independent variables (16 ea).
In spite of the above following solution for MC6 = 930 was found by A. W. Johnson Jr (1981/82):
Pan Magic Square
67 |
193 |
71 |
251 |
109 |
239 |
139 |
233 |
113 |
181 |
157 |
107 |
241 |
97 |
191 |
89 |
163 |
149 |
73 |
167 |
131 |
229 |
151 |
179 |
199 |
103 |
227 |
101 |
127 |
173 |
211 |
137 |
197 |
79 |
223 |
83 |
Subject square corresponds with numerous Prime Number Pan Magic Squares with the same Magic Sum and variable values.
14.13.4 Simple Magic Squares (6 x 6)
Prime Number Simple Magic Squares of order 6 can be constructed very efficiently with the Generator Principle, as applied for the construction of Bimagic Squares.
The Generator Method, as applied for Consecutive Prime Numbers can be summarised as follows:
-
Generate the Magic Series for the applicable 36 Consecutive Prime Numbers and the related Magic Constant
(ref. MgcLns6);
-
Construct Generators with 6 Magic Rows, based on the Magic Series obtained above
(ref. CnstrGen01);
-
Construct Semi Magic Squares based on the Generators obtained above, by permutating the numbers within the rows and
determine the number of related Magic Squares (ref. CnstrSqrs6);
-
Permutate the rows and columns within the Semi Magic Squares, in order to obtain Magic Squares (if possible).
For the Consecutive Prime Numbers used in Section 14.13.3 above (MC6 = 930), 12980 Magic Series could be generated, resulting in numerous Generators.
In order to limit the collection a little bit, 585 Generators were selected based on the application of 8 Unique Magic Series for each Generator.
The first Generator resulted already in 566 Semi Magic Squares with 671 related Simple Magic Squares.
The first occurring Semi Magic Square and the resulting Simple Magic Square - after row and column permutation(s) - are shown below:
Semi Magic Square
67 |
79 |
233 |
191 |
181 |
179 |
71 |
229 |
101 |
197 |
193 |
139 |
73 |
239 |
103 |
199 |
149 |
167 |
227 |
83 |
173 |
127 |
163 |
157 |
241 |
89 |
223 |
109 |
131 |
137 |
251 |
211 |
97 |
107 |
113 |
151 |
|
Simple Magic Square
101 |
197 |
193 |
139 |
71 |
229 |
103 |
199 |
149 |
167 |
73 |
239 |
173 |
127 |
163 |
157 |
227 |
83 |
223 |
109 |
131 |
137 |
241 |
89 |
97 |
107 |
113 |
151 |
251 |
211 |
233 |
191 |
181 |
179 |
67 |
79 |
|
The method described above has been applied for miscellaneous Magic Sums, for which
the first occurring Simple Magic Squares are shown in Attachment 14.13.4.
Each square shown corresponds with numerous Prime Number Magic Squares with the same Magic Sum and variable values.
14.13.5a Simple Magic Squares (7 x 7)
Prime Number Simple Magic Squares of order 7 can be constructed with the Generator Principle, as discussed in Section 14.13.4 above.
A possible Semi Magic Square and resulting Simple Magic Square are shown below,
for the smallest consecutive prime numbers {7 ... 239} for which an Order 7 Simple Magic Square exists (MC7 = 797):
Semi Magic Square
7 |
17 |
193 |
167 |
163 |
137 |
113 |
11 |
19 |
97 |
191 |
179 |
149 |
151 |
13 |
23 |
211 |
181 |
109 |
157 |
103 |
67 |
197 |
199 |
127 |
53 |
71 |
83 |
227 |
223 |
31 |
43 |
61 |
73 |
139 |
233 |
89 |
29 |
41 |
173 |
131 |
101 |
239 |
229 |
37 |
47 |
59 |
79 |
107 |
|
Simple Magic Square
13 |
23 |
109 |
103 |
181 |
211 |
157 |
227 |
223 |
61 |
139 |
43 |
31 |
73 |
7 |
17 |
163 |
113 |
167 |
193 |
137 |
239 |
229 |
59 |
107 |
47 |
37 |
79 |
11 |
19 |
179 |
151 |
191 |
97 |
149 |
233 |
89 |
173 |
101 |
41 |
29 |
131 |
67 |
197 |
53 |
83 |
127 |
199 |
71 |
|
The Generator Method has been applied for miscellaneous Magic Sums, for which
the first occurring Simple Magic Squares are shown in Attachment 14.13.5.
Each square shown corresponds with numerous Prime Number Magic Squares with the same Magic Sum and variable values.
14.13.5b Inlaid Magic Squares (7 x 7)
Occasionally Prime Number Inlaid Magic Squares of order 7 with Diamond Inlays can be constructed.
An example is shown below, for the consecutive prime numbers {7 ... 239} with the related Magic Sum s7 = 797.
Inlaid Magic Square
199 |
11 |
19 |
107 |
227 |
53 |
181 |
211 |
109 |
151 |
71 |
61 |
157 |
37 |
47 |
103 |
233 |
73 |
149 |
13 |
179 |
43 |
89 |
41 |
131 |
97 |
173 |
223 |
127 |
229 |
113 |
193 |
29 |
83 |
23 |
163 |
59 |
101 |
191 |
67 |
79 |
137 |
7 |
197 |
139 |
31 |
167 |
239 |
17 |
The Inlaid Magic Square shown above contains:
-
One 3th order Magic Diamond Inlay with Magic Sum s3 = 393
-
One 4th order Magic Diamond Inlay with Magic Sum s4 = 404
and is unique for the applied Magic Sums and variable values.
14.13.6 Simple Magic Squares (8 x 8)
Prime Number Simple Magic Squares of order 8 can be constructed with the Generator Principle, as applied in previous sections.
A possible Semi Magic Square and resulting Simple Magic Square are shown below, for the smallest consecutive prime numbers {79 ... 439}
for which an Order 8 Simple Magic Square exists (MC8 = 2016):
Semi Magic Square
439 |
433 |
137 |
157 |
179 |
191 |
229 |
251 |
431 |
421 |
131 |
151 |
277 |
181 |
197 |
227 |
419 |
389 |
127 |
281 |
163 |
193 |
211 |
233 |
379 |
353 |
113 |
149 |
337 |
199 |
223 |
263 |
97 |
109 |
409 |
383 |
173 |
349 |
257 |
239 |
89 |
103 |
401 |
139 |
373 |
307 |
311 |
293 |
83 |
101 |
331 |
359 |
347 |
283 |
271 |
241 |
79 |
107 |
367 |
397 |
167 |
313 |
317 |
269 |
|
Simple Magic Square
229 |
439 |
433 |
137 |
191 |
179 |
157 |
251 |
197 |
431 |
421 |
131 |
181 |
277 |
151 |
227 |
311 |
89 |
103 |
401 |
307 |
373 |
139 |
293 |
271 |
83 |
101 |
331 |
283 |
347 |
359 |
241 |
223 |
379 |
353 |
113 |
199 |
337 |
149 |
263 |
257 |
97 |
109 |
409 |
349 |
173 |
383 |
239 |
211 |
419 |
389 |
127 |
193 |
163 |
281 |
233 |
317 |
79 |
107 |
367 |
313 |
167 |
397 |
269 |
|
The Generator Method has been applied for miscellaneous Magic Sums, for which
the first occurring Simple Magic Squares are shown in Attachment 14.13.6.
Each square shown corresponds with numerous Prime Number Magic Squares with the same Magic Sum and variable values.
14.13.7a Simple Magic Squares (9 x 9)
Prime Number Simple Magic Squares of order 9 can be constructed with the Generator Principle, as applied in previous sections.
A possible Semi Magic Square and resulting Simple Magic Square are shown below, for the smallest consecutive prime numbers {37 ... 479}
for which an Order 9 Simple Magic Square exists (MC9 = 2211):
Semi Magic Square
37 |
41 |
43 |
59 |
463 |
307 |
373 |
409 |
479 |
67 |
83 |
113 |
47 |
359 |
353 |
421 |
389 |
379 |
157 |
127 |
179 |
71 |
439 |
367 |
397 |
191 |
283 |
211 |
151 |
181 |
337 |
227 |
347 |
103 |
383 |
271 |
233 |
263 |
251 |
401 |
223 |
269 |
229 |
149 |
193 |
241 |
311 |
277 |
433 |
73 |
281 |
293 |
163 |
139 |
349 |
331 |
317 |
457 |
313 |
101 |
109 |
97 |
137 |
449 |
443 |
419 |
239 |
53 |
107 |
197 |
173 |
131 |
467 |
461 |
431 |
167 |
61 |
79 |
89 |
257 |
199 |
|
Simple Magic Square
83 |
359 |
389 |
47 |
67 |
379 |
353 |
113 |
421 |
127 |
439 |
191 |
71 |
157 |
283 |
367 |
179 |
397 |
151 |
227 |
383 |
337 |
211 |
271 |
347 |
181 |
103 |
263 |
223 |
149 |
401 |
233 |
193 |
269 |
251 |
229 |
41 |
463 |
409 |
59 |
37 |
479 |
307 |
43 |
373 |
311 |
73 |
163 |
433 |
241 |
139 |
281 |
277 |
293 |
331 |
313 |
97 |
457 |
349 |
137 |
101 |
317 |
109 |
461 |
61 |
257 |
167 |
467 |
199 |
79 |
431 |
89 |
443 |
53 |
173 |
239 |
449 |
131 |
107 |
419 |
197 |
|
The Magic Square shown above is essential different from the corresponding Magic Square as
previously published by A. Susuki (1957).
The Generator Method has been applied for miscellaneous Magic Sums, for which
the first occurring Simple Magic Squares are shown in Attachment 14.13.7.
Each square shown corresponds with numerous Prime Number Magic Squares with the same Magic Sum and variable values.
14.13.7b Composed Magic Squares (9 x 9)
Prime Number Composed Magic Squares of order 9 can be constructed when the Magic Sum s9 is a multiple of 9.
An example is shown below, for the consecutive prime numbers {601 ... 1151} with the related Magic Sum s9 = 7821.
Composed Magic Square
1103 |
619 |
1021 |
733 |
701 |
1013 |
853 |
691 |
1087 |
727 |
1063 |
653 |
1033 |
773 |
941 |
811 |
997 |
823 |
607 |
1051 |
709 |
1109 |
1049 |
881 |
751 |
757 |
907 |
1039 |
743 |
1093 |
601 |
953 |
641 |
1061 |
1031 |
659 |
937 |
827 |
829 |
883 |
613 |
983 |
1151 |
967 |
631 |
859 |
839 |
769 |
1009 |
1097 |
617 |
919 |
643 |
1069 |
877 |
821 |
991 |
787 |
857 |
977 |
863 |
929 |
719 |
911 |
971 |
947 |
647 |
661 |
1091 |
673 |
1123 |
797 |
761 |
887 |
809 |
1019 |
1117 |
677 |
739 |
683 |
1129 |
The Magic Square shown above is composed of:
-
One 4th order Magic Corner Square with Magic Sum s4 = 4 * s9 / 9 = 3476 (top/left)
-
One 5th order Magic Corner Square with Magic Sum s5 = 5 * s9 / 9 = 4345 (bottom/right)
-
Two Magic Rectangles order 4 x 5 with s4 = 3476 and s5 = 4345
Subject Magic Squares can be transformed to:
-
Order 9 Inlaid Magic Squares with order 4 and 5 Square Inlays
-
Order 9 Bordered Magic Squares with order 5 Magic Center Square
As illustrated below:
Inlaid Magic Square
613 |
937 |
983 |
827 |
1151 |
829 |
967 |
883 |
631 |
701 |
1103 |
1013 |
619 |
853 |
1021 |
691 |
733 |
1087 |
1097 |
859 |
617 |
839 |
919 |
769 |
643 |
1009 |
1069 |
773 |
727 |
941 |
1063 |
811 |
653 |
997 |
1033 |
823 |
857 |
877 |
977 |
821 |
863 |
991 |
929 |
787 |
719 |
1049 |
607 |
881 |
1051 |
751 |
709 |
757 |
1109 |
907 |
661 |
911 |
1091 |
971 |
673 |
947 |
1123 |
647 |
797 |
953 |
1039 |
641 |
743 |
1061 |
1093 |
1031 |
601 |
659 |
1117 |
761 |
677 |
887 |
739 |
809 |
683 |
1019 |
1129 |
|
Bordered Magic Square
1103 |
619 |
701 |
1013 |
853 |
691 |
1087 |
1021 |
733 |
727 |
1063 |
773 |
941 |
811 |
997 |
823 |
653 |
1033 |
937 |
827 |
613 |
983 |
1151 |
967 |
631 |
829 |
883 |
859 |
839 |
1097 |
617 |
919 |
643 |
1069 |
769 |
1009 |
877 |
821 |
857 |
977 |
863 |
929 |
719 |
991 |
787 |
911 |
971 |
661 |
1091 |
673 |
1123 |
797 |
947 |
647 |
761 |
887 |
1117 |
677 |
739 |
683 |
1129 |
809 |
1019 |
607 |
1051 |
1049 |
881 |
751 |
757 |
907 |
709 |
1109 |
1039 |
743 |
953 |
641 |
1061 |
1031 |
659 |
1093 |
601 |
|
It should be noted that the reversed transformation is not necessarily possible because of the bottom-left / top-right Main Diagonal.
Each square shown corresponds with numerous Prime Number Magic Squares with the same Magic Sum(s) and variable values.
14.13.7c Inlaid Magic Squares (9 x 9)
Diamond Inlays Order 4 and 5
Prime Number Inlaid Magic Squares of order 9 with Diamond Inlays can be constructed when the Magic Sum s9 is a multiple of 9.
An example is shown below, for the consecutive prime numbers {601 ... 1151} with the related Magic Sum s9 = 7821.
Inlaid Magic Square
701 |
1061 |
971 |
769 |
631 |
1049 |
821 |
827 |
991 |
839 |
829 |
911 |
1069 |
727 |
967 |
787 |
809 |
883 |
941 |
659 |
719 |
1021 |
643 |
1039 |
1151 |
887 |
761 |
881 |
797 |
619 |
929 |
653 |
919 |
1103 |
983 |
937 |
1129 |
1109 |
1123 |
1051 |
863 |
709 |
617 |
607 |
613 |
691 |
683 |
733 |
673 |
1063 |
977 |
1093 |
1097 |
811 |
1013 |
953 |
739 |
601 |
1091 |
743 |
857 |
877 |
947 |
773 |
823 |
997 |
677 |
1033 |
661 |
751 |
1087 |
1019 |
853 |
907 |
1009 |
1031 |
1117 |
757 |
641 |
647 |
859 |
The Inlaid Magic Square shown above contains:
-
One 4th order Magic Diamond Inlay with Magic Sum s4 = 4 * s9 / 9 = 3476
-
One 5th order Magic Diamond Inlay with Magic Sum s5 = 5 * s9 / 9 = 4345
and corresponds with miscellaneous Prime Number Magic Squares with the same Magic Sum(s) and variable values.
14.13.8 Summary
The obtained results regarding the miscellaneous types of Prime Number Magic Squares as deducted and discussed in previous sections are summarized in following table:
|