Office Applications and Entertainment, Magic Squares  
Index  About the Author 
14.0 Special Magic Squares, Prime Numbers
Prime Number Magic squares can be generated with comparable routines as discussed in previous section,
however based on prime variable values {a_{i}} with i = 1 ... n.
14.1 Magic Squares (3 x 3)
The equations defining a Magic Square of the third order are: a(7) = s1  a(8)  a(9) a(6) = 4 * s1 / 3  a(8)  2 * a(9) a(5) = s1 / 3 a(4) = 2 * s1 / 3  a(6) a(3) = 2 * s1 / 3  a(7) a(2) = 2 * s1 / 3  a(8) a(1) = 2 * s1 / 3  a(9)
with a(9) and a(8) the independent variables. Consequently the variable Magic Sum s1 should be divisible by 3.
14.1.2 Semi Magic Squares (3 x 3), Seven Magic Lines
In Section 14.4.10 will be discussed how 6^{th} order Prime Number Simple Magic Squares can be constructed based on 3^{th} order Prime Number Magic Squares with only seven Magic Lines (Semi Magic).
The equations defining Semi Magic Squares with seven Magic Lines of the third order are: a(7) = s1  a(8)  a(9) a(5) =  s1 + a(6) + a(8) + 2 * a(9) a(4) = 2 * s1  2 * a(6)  a(8)  2 * a(9) a(3) = s1  a(6)  a(9) a(2) = 2 * s1  a(6)  2 * a(8)  2 * a(9) a(1) = 2 * s1 + 2 * a(6) + 2 * a(8) + 3 * a(9)
with a(9), a(8) and a(6) the independent variables.
14.2 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)
a comparable routine can be written to generate Prime Number Magic Squares of order 4 (ref. Priem4).
14.2.2 Pan Magic Squares (4 x 4)
Based on the equations defining a Pan Magic Square of the fourth order: a(13) = s1  a(14)  a(15)  a(16) a(11) = s1  a(12)  a(15)  a(16) a(10) = a(12)  a(14) + a(16) a(9) =  a(12) + a(14) + a(15) a(8) = 0.5 * s1  a(14) a(7) = 0.5 * s1 + a(14) + a(15) + a(16) a(6) = 0.5 * s1  a(16) a(5) = 0.5 * s1  a(15) a(4) = 0.5 * s1  a(12) + a(14)  a(16) a(3) = 0.5 * s1 + a(12)  a(14)  a(15) a(2) = 0.5 * s1  a(12) a(1) = 0.5 * s1 + a(12) + a(15) + a(16)
a comparable routine can be written to generate Prime Number Pan Magic Squares of order 4
(ref. Priem4b).
14.2.3 Associated Magic Squares (4 x 4)
Based on the equations defining an Associated Magic Square of the fourth order: a(13) = s1  a(14)  a(15)  a(16) a(11) = s1  a(12)  a(15)  a(16) a(10) = s1  a(12)  a(14)  a(16) a( 9) = s1  a(10)  a(11)  a(12) a( 8) = 0.5 * s1  a( 9) a( 7) = 0.5 * s1  a(10) a( 6) = 0.5 * s1  a(11) a( 5) = 0.5 * s1  a(12) a( 4) = 0.5 * s1  a(13) a( 3) = 0.5 * s1  a(14) a( 2) = 0.5 * s1  a(15) a( 1) = 0.5 * s1  a(16)
a comparable routine can be written to generate Prime Number Associated Magic Squares of order 4
(ref. Priem4d).
A comparable routine can be written to generate Prime Number Magic Squares of order 5, however such a routine is not very feasible due to the high number of independent variables (14 ea).
14.3.1 Pan Magic Squares (5 x 5)
Based on the equations defining a Pan 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(15) = a(17) + a(18)  a(25) a(14) = s1  a(18)  a(19)  a(20)  a(24) a(13) = s1  a(17)  a(18)  a(19)  a(23) a(12) = a(19) + a(20)  a(22) a(11) = a(18) + a(19)  a(21) a(10) = s1  a(17)  a(18)  a(22)  a(23) a( 9) = s1  a(16)  a(17)  a(21)  a(22) a( 8) = s1  a(16)  a(20)  a(21)  a(25) a( 7) = s1  a(19)  a(20)  a(24)  a(25) a( 6) = s1  a(18)  a(19)  a(23)  a(24) a( 5) =  a(20) + a(22) + a(23) a( 4) =  a(19) + a(21) + a(22) a( 3) =  a(18) + a(21) + a(25) a( 2) =  a(17) + a(24) + a(25) a( 1) =  a(16) + a(23) + a(24)
a comparable routine can be written to generate Prime Number Pan Magic Squares of order 5 (ref. Priem5b1).
14.3.2 Concentric Magic Squares (5 x 5)
A 5^{th} order Prime Number Concentric Magic Square consists of a Prime Number Embedded Magic Square of the 3^{th} order with a border around it.
Based on the equations defining a Concentric Magic Square of the fifth order: a(21) = s1  a(22)  a(23)  a(24)  a(25) a(17) = 0.6 * s1  a(18)  a(19) a(16) = 0.4 * s1  a(20) a(14) = 0.8 * s1  a(18)  2 * a(19) a(13) = 0.2 * s1 a(12) = 0.4 * s1  a(14) a(11) = 0.4 * s1  a(15) a(10) = 0.6 * s1  a(15)  a(20) + a(21)  a(25) a( 9) = 0.4 * s1  a(17) a( 8) = 0.4 * s1  a(18) a( 7) = 0.4 * s1  a(19) a( 6) = 0.4 * s1  a(10) a( 5) = 0.4 * s1  a(21) a( 4) = 0.4 * s1  a(24) a( 3) = 0.4 * s1  a(23) a( 2) = 0.4 * s1  a(22) a( 1) = 0.4 * s1  a(25)
a comparable routine can be written to generate Prime Number Concentric Magic Squares of order 5 (ref. Priem5c).
14.3.3 Eccentric Magic Squares (5 x 5)
A 5^{th} order Prime Number Eccentric Magic Square consists of one Prime Number Magic Corner Square of the 3^{th} order, supplemented with two rows and two columns.
a(23) = 0.6 * s1  a(24)  a(25) a(21) = 0.4 * s1  a(22) a(20) = 0.8 * s1  a(24)  2 * a(25) a(19) = 0.2 * s1 a(18) = 0.4 * s1  a(20) a(16) = 0.4 * s1  a(17) a(15) = 0.4 * s1  a(23) a(14) = 0.4 * s1  a(24) a(13) = 0.4 * s1  a(25) a(11) = 0.4 * s1  a(12) a( 9) = 0.6 * s1 + a(10)  a(13)  a(17)  a(21) a( 7) = 0.4 * s1 (a( 8) + a( 9) + a(10) + a(12)  a(16)  a(21))/2 a( 6) = s1  a( 7)  a( 8)  a( 9)  a(10) a( 5) = 0.4 * s1  a(10) a( 4) = 0.4 * s1  a( 9) a( 3) = 0.4 * s1  a( 8) a( 2) = 0.4 * s1  a( 6) a( 1) = 0.4 * s1  a( 7)
a comparable routine can be written to generate Prime Number Eccentric Magic Squares of order 5 (ref. Priem5d).
14.3.4 Center Symmetric Magic Squares (5 x 5)
A 5^{th} order Prime Number Center Symmetric Magic Square is
a Prime Number Magic Square where the two numbers of each of the 12 Center Symmetric Pairs are Complementary.
a(21) = s1  a(22)  a(23)  a(24)  a(25) a(16) = s1  a(17)  a(18)  a(19)  a(20) a(15) = s1 / 5 + a(16)  a(20) + a(21)  a(25) a(14) = s1 / 5 + a(17)  a(19) + a(22)  a(24) a(13) = s1 / 5 a(12) = 2 * s1 / 5  a(14) a(11) = 2 * s1 / 5  a(15) a(10) = 2 * s1 / 5  a(16) a( 9) = 2 * s1 / 5  a(17) a( 8) = 2 * s1 / 5  a(18) a( 7) = 2 * s1 / 5  a(19) a( 6) = 2 * s1 / 5  a(20) a( 5) = 2 * s1 / 5  a(21) a( 4) = 2 * s1 / 5  a(22) a( 3) = 2 * s1 / 5  a(23) a( 2) = 2 * s1 / 5  a(24) a( 1) = 2 * s1 / 5  a(25)
a comparable routine can be written to generate Prime Number Center Symmetric Magic Squares of order 5 (ref. Priem5e).
14.3.5 Ultra Magic Squares (5 x 5)
A 5^{th} order Prime Number Ultra Magic Square is a Prime Number Center Symmetric Pan Magic Square.
a(21) = s1  a(22)  a(23)  a(24)  a(25) a(20) = 0.6 * s1  a(24)  a(25) a(19) = 0.6 * s1 + a(22)  a(23)  a(24)  a(25) a(18) = 0.6 * s1  a(22)  a(24) a(17) = 0.4 * s1 + 2 * a(24) + a(25) a(16) = 0.4 * s1 + a(23) + a(24) + a(25) a(15) = 0.2 * s1  a(22) + a(24) a(14) = 0.8 * s1 + a(23) + 2 * a(24) + 2 * a(25) a(13) = s1 / 5 a(12) = 2 * s1 / 5  a(14) a(11) = 2 * s1 / 5  a(15) a(10) = 2 * s1 / 5  a(16) a( 9) = 2 * s1 / 5  a(17) a( 8) = 2 * s1 / 5  a(18) a( 7) = 2 * s1 / 5  a(19) a( 6) = 2 * s1 / 5  a(20) a( 5) = 2 * s1 / 5  a(21) a( 4) = 2 * s1 / 5  a(22) a( 3) = 2 * s1 / 5  a(23) a( 2) = 2 * s1 / 5  a(24) a( 1) = 2 * s1 / 5  a(25)
a comparable routine can be written to generate Prime Number Ultra Magic Squares of order 5
(ref. Priem5f).
14.3.6 Diamond Inlay, Associated Magic Squares (5 x 5)
When an embedded Magic Square is rotated 45 degrees, the embedded square is referred to as a Diamond Inlay.
a(21) = s1  a(22)  a(23)  a(24)  a(25) a(18) = 0.8 * s1 + a(19)  2 * a(20)  a(22) + 2 * a(23)  a(24)  2 * a(25) a(17) = 0.8 * s1  a(19)  2 * a(23) a(16) = 0.6 * s1  a(19) + a(20) + a(22) + a(24) + 2 * a(25) a(15) = 0.6 * s1  a(19)  a(23) a(14) = s1  2 * a(19) + a(22)  2 * a(23)  a(24) a(13) = 0.2 * s1 a(12) = 0.4 * s1  a(14) a(11) = 0.4 * s1  a(15) a(10) = 0.4 * s1  a(16) a( 9) = 0.4 * s1  a(17) a( 8) = 0.4 * s1  a(18) a( 7) = 0.4 * s1  a(19) a( 6) = 0.4 * s1  a(20) a( 5) = 0.4 * s1  a(21) a( 4) = 0.4 * s1  a(22) a( 3) = 0.4 * s1  a(23) a( 2) = 0.4 * s1  a(24) a( 1) = 0.4 * s1  a(25)
a comparable routine can be written to generate
Associated Magic Squares with Diamond Inlays (ref. Priem5g1).
14.3.7 Diamond Inlay, Concentric Magic Squares (5 x 5)
Based on the equations defining a fifth order Concentric Magic Square with a third order Diamond Inlay: a(21) = s1  a(22)  a(23)  a(24)  a(25) a(18) = 0.2 * s1 + 2 * a(23) a(17) = 0.8 * s1  a(19)  2 * a(23) a(16) = 0.4 * s1  a(20) a(15) = 0.6 * s1  a(19)  a(23) a(14) = s1  2 * a(19)  2 * a(23) a(13) = 0.2 * s1 a(12) = 0.4 * s1  a(14) a(11) = 0.4 * s1  a(15) a(10) = s1 + a(19)  a(20)  a(22)  a(24)  2 * a(25) a( 9) = 0.4 * s1  a(17) a( 8) = 0.4 * s1  a(18) a( 7) = 0.4 * s1  a(19) a( 6) = 0.4 * s1  a(10) a( 5) = 0.4 * s1  a(21) a( 4) = 0.4 * s1  a(24) a( 3) = 0.4 * s1  a(23) a( 2) = 0.4 * s1  a(22) a( 1) = 0.4 * s1  a(25)
a comparable routine can be written to generate
Concentric Magic Squares with Diamond Inlays
(ref. Priem5g2).
14.3.8 Square Inlay, General (5 x 5)
Based on the equations defining a fifth order Magic Square with a third order Square Inlay: a(22) = 0.4 * s1  a(24) a(21) = s1  a(22)  a(23)  a(24)  a(25) a(16) = s1  a(17)  a(18)  a(19)  a(20) a(15) = 0.4 * s1 + 2 * a(21) + a(23) a(13) = 0.2 * s1 a(12) = 0.4 * s1  a(14) a(11) = a(13)  a(21) + a(25) a(10) = 0.4 * s1  a(20) a( 9) = 0.4 * s1  a(17) a( 8) = 0.4 * s1  a(18) a( 7) = 0.4 * s1  a(19) a( 6) = 0.4 * s1  a(16) a( 5) = s1  a(10)  a(15)  a(20)  a(25) 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( 6)  a(11)  a(16)  a(21)
a comparable routine can be written to generate
Magic Squares with Square Inlays (ref. Priem5g3).
14.3.9 Square and Diamond Inlay (5 x 5)
Based on the equations defining a fifth order Magic Square with third order Square and Diamond Inlay: a(22) = 0.4 * s1  a(24) a(21) = 0.6 * s1  a(23)  a(25) a(19) = 0.2 * s1 + 2 * a(25) a(17) = s1  2 * a(23)  2 * a(25) a(16) = 0.2 * s1  a(18)  a(20) + 2 * a(23) a(15) = 0.8 * s1  a(23)  2 * a(25) a(13) = 0.2 * s1 a(12) = 0.4 * s1  a(14) a(11) = 0.4 * s1 + a(23) + 2 * a(25) a(10) = 0.4 * s1  a(20) a( 9) = 0.6 * s1 + 2 * a(23) + 2 * a(25) a( 8) = 0.4 * s1  a(18) a( 7) = 0.6 * s1  2 * a(25) a( 6) = 0.2 * s1 + a(18) + a(20)  2 * a(23) a( 5) = 0.2 * s1 + a(23) + a(25) a( 4) = 1.8 * s1  a(14)  2 * a(23)  a(24)  4 * a(25) a( 3) = 0.4 * s1  a(23) a( 2) = 1.4 * s1 + a(14) + 2 * a(23) + a(24) + 4 * a(25) a( 1) = 0.4 * s1  a(25)
a comparable routine can be written to generate
Magic Squares with Square and Diamond Inlays
(ref. Priem5g4).
14.3.10 Anti Symmetric Magic Squares (5 x 5)
Anti Symmetric Magic Squares of order 5 are Magic Squares for which
a_{i} + a_{j} ≠ 0.4 * s1 for any i and j (i,j = 1 ... 25; i ≠ j).
Anti Symmetric Magic Squares occur in complementary pairs.
Anti Symmetric Magic Squares, suitable for the construction of ad. a and b above, must have the number s1/5 in one of the corners, say the bottom/right corner.
Above described procedure generated 184 Prime Number Anti Symmetric Magic Squares  with Corner Element s1/5  per two hours (average), of which 48 are shown in Attachment 14.3.11.
For Anti Symmetric Magic Squares, suitable for the construction of ad. c, d and e above, the number s1/5 should be eliminated.
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)
but starting with the values of the Anti Symmetric Magic Squares listed in Attachment 14.3.11
(ref. AntSym2).
The obtained results regarding the miscellaneous types of Prime Number Magic Squares as deducted and discussed in previous sections are summarized in following table: 
Order
Type
Characteristics
Subroutine
Results
3 x 3
Simple Magic
Classic
Arithmetic Series
Attachment 14.2 page 1
Triplets
Attachment 14.2 page 2
Semi Magic
Seven Magic Lines
4 x 4
Simple Magic
Classic
Consecutive Primes
Pan Magic

Associated

5 x 5
Pan Magic

Concentric

Eccentric

Associated

Ultra Magic

Diamond Inlay
Associated
Concentric
Square Inlay
General
Diamond Inlay
Anti Symmetric
Corner = s1/5
s1/5 eliminated
Comparable routines as listed above, can be used to generate Prime Number Magic Squares of order 6, which will be described in following sections.

Index  About the Author 