Office Applications and Entertainment, Latin Squares  Index About the Author

4.0   Latin Squares (4 x 4)

A Latin Square of order 4 is a 4 x 4 square filled with 4 different symbols, each occurring only once in each row and only once in each column.

Attachment 4.0.1 shows the 576 ea order 4 Latin Squares, which can be found based on this definition (ref. LatSqr4).

For the construction of order 4 Magic Squares normally only those Latin Squares are used for which the 4 different symbols occur also only once in each of the main diagonals (Latin Diagonal Squares).

4.1   Latin Diagonal Squares (4 x 4)

Attachment 4.1.1 shows the 48 ea order 4 Latin Diagonal Squares, which can be found based on the definition formulated above (ref. LatSqr4).

Suitable Euler Squares can be found, by selecting pairs of Latin Diagonal Squares (A, B) while ensuring that the resulting square M contains 16 distinct pairs.

Attachment 4.1.2 shows the 1152 ea resulting Euler Squares for the symbols {ai} = {0, 1, 2, 3} and {bi} = {0, 1, 2, 3} (ref. CnstrSqrs4a).

If the series {ai} and {bi} are replaced by the symbols {J, Q, K, A} and {, , , } the first solution can be rewritten as:

A
 K A J Q J Q K A Q J A K A K Q J
B
 ♦ ♥ ♣ ♠ ♠ ♣ ♥ ♦ ♥ ♦ ♠ ♣ ♣ ♠ ♦ ♥
(A, B)
 K♦ A♥ J♣ Q♠ J♠ Q♣ K♥ A♦ Q♥ J♦ A♠ K♣ A♣ K♠ Q♦ J♥

which is one of the solutions - found by Jacques Ozanam (1725) - of an old but comparable playing cards puzzle.

The puzzle was later studied by Rouse Ball, Martin Gardner and finally by Kathleen Ollerenshaw, who did find the correct number of possible solution (8 x 144 = 1152).

4.2   Magic Squares, Natural Numbers

4.2.1 Simple Magic Squares

Simple Magic Square M of order 4 with the integers 1 ... 16 can be written as M = A + 4 * B +  where the squares A and B contain only the integers 0, 1, 2 and 3.

Consequently order 4 Simple Magic Squares can be based on pairs of Orthogonal Latin Diagonal Squares (A, B) which is illustrated below for a Simple Magic Square M.

A
 2 3 0 1 0 1 2 3 1 0 3 2 3 2 1 0
B
 1 0 3 2 2 3 0 1 0 1 2 3 3 2 1 0
M = A + 4 * B + 1
 7 4 13 10 9 14 3 8 2 5 12 15 16 11 6 1

Attachment 4.2.1 shows the 1152 ea Simple Magic Squares which can be constructed based on the 1152 ea Euler Squares found in Section 4.1 above.

Note: Based on the complete collection of 576 Latin Squares (ref. Attachment 4.0.1) 1536 order 4 Simple Magic Squares can be constructed.

4.2.2 Pan Magic Squares

Attachment 4.1.3, page 1 shows the 16 order 4 Latin Diagonal Squares for which the Main - and Broken Diagonals sum to 6.

Attachment 4.1.3, page 2 shows the 32 order 4 Latin Squares for which the Main - and Broken Diagonals sum to 6.

Attachment 4.1.3, page 3 shows 16 order 4 Semi-Latin Squares with Latin Main - and Broken Diagonals (summing to 6).

Order 4 Pan Magic Squares M can be based on pairs of Orthogonal (Latin Diagonal) Squares (A, B) out of these collections, which is illustrated below:

A
 1 0 3 2 2 3 0 1 0 1 2 3 3 2 1 0
B
 1 2 0 3 0 3 1 2 3 0 2 1 2 1 3 0
M = A + 4 * B + 1
 6 9 4 15 3 16 5 10 13 2 11 8 12 7 14 1

Attachment 4.2.2, page 1 shows the 128 ea Pan Magic Squares which can be constructed based on the 16 ea Latin Diagonal Squares found above.

Attachment 4.2.2, page 2 shows the 256 ea Pan Magic Squares which can be constructed based on the 32 ea Latin Squares found above.

The 384 Pan Magic Squares as shown in Attachment 1, can be constructed based on page 2 and 3 of Attachment 4.1.3.

4.2.3 Associated Magic Squares

Attachment 4.1.4, page 1 shows the 16 possible order 4 Associated Latin Diagonal Squares.

Attachment 4.1.4, page 2 shows the 32 possible order 4 Associated Latin Squares.

Attachment 4.1.4, page 3 shows 16 order 4 Associated Semi-Latin Squares.

Order 4 Associated Magic Squares M can be based on pairs of Orthogonal (Latin Diagonal) Squares (A, B) out of these collections, as shown below for a set of Semi-Latin Squares and the symbols {ai, i = 1 ... 4} and {bj, j = 1 ... 4).

A
 a4 a3 a2 a1 a1 a2 a3 a4 a1 a2 a3 a4 a4 a3 a2 a1
B
 b4 b1 b1 b4 b3 b2 b2 b3 b2 b3 b3 b2 b1 b4 b4 b1
(A, B)
 a4, b4 a3, b1 a2, b1 a1, b4 a1, b3 a2, b2 a3, b2 a4, b3 a1, b2 a2, b3 a3, b3 a4, b2 a4, b1 a3, b4 a2, b4 a1, b1

All pairs of the resulting square (A, B) are distinct, as illustrated by following numerical example:

A
 3 2 1 0 0 1 2 3 0 1 2 3 3 2 1 0
B
 3 0 0 3 2 1 1 2 1 2 2 1 0 3 3 0
M = A + 4 * B + 1
 16 3 2 13 9 6 7 12 5 10 11 8 4 15 14 1

Attachment 4.2.3, page 1 shows the 128 ea Associated Magic Squares which can be constructed based on the 16 ea Associated Latin Diagonal Squares found above.

Attachment 4.2.3, page 2 shows the 256 ea Associated Magic Squares which can be constructed based on the 32 ea Associated Latin Squares found above.

The 384 Associated Magic Squares as shown in Attachment 2.5, can be constructed based on page 2 and 3 of Attachment 4.1.4.

4.2.4 Evaluation of the Results

Following table compares the enumeration results for order 4 Magic Squares (ref. Section 2.7) with the results based on the construction methods described above:

 Type Enumerated Constructed Base Simple (All) 7040 1536 Latin 1252 Latin Diagonal Pan Magic 384 256 Latin 128 Latin Diagonal Associated 384 256 Latin 128 Latin Diagonal

The constructability by means of Orthogonal (Latin Diagonal) Squares can be considered as an additional property.

4.3   Magic Squares, Prime Numbers

4.3.1 Simple Magic Squares

When the elements {ai, i = 1 ... 4} and {bj, j = 1 ... 4) of a valid pair of Orthogonal Latin Diagonal Squares (A, B) - as applied in Section 4.2.1 above - complies with following condition:

• mij = ai + bj = prime for i = 1 ... 4 and j = 1 ... 4 (correlated)

the resulting square M = A + B will be an order 4 Prime Number Simple Magic Square:

Sa = 82
 3 1 57 21 21 57 1 3 1 3 21 57 57 21 3 1
Sb = 68
 40 2 16 10 16 10 40 2 10 16 2 40 2 40 10 16
Sm = 150
 43 3 73 31 37 67 41 5 11 19 23 97 59 61 13 17

Attachment 4.3, page 1 contains miscellaneous correlated unbalanced series {ai, i = 1 ... 4} and {bj, j = 1 ... 4).

Attachment 4.3.1 contains the resulting Prime Number Simple Magic Squares and related Magic Sums (Sm).

Each square shown corresponds with 1152 Prime Number Simple Magic Squares.

4.3.2 Pan Magic Squares

When the elements {ai, i = 1 ... 4} and {bj, j = 1 ... 4) of a valid pair of Orthogonal Latin Diagonal Squares (A, B) - as applied in Section 4.2.2 above - comply with following conditions:

• mij = ai + bj = prime for i = 1 ... 4 and j = 1 ... 4 (correlated)
• a1 + a4 = a2 + a3 and b1 + b4 = b2 + b3               (balanced)

the resulting square M = A + B will be an order 4 Prime Number Pan Magic Square:

Sa = 36
 7 1 17 11 11 17 1 7 1 7 11 17 17 11 7 1
Sb = 204
 96 6 72 30 72 30 96 6 30 72 6 96 6 96 30 72
Sm = 240
 103 7 89 41 83 47 97 13 31 79 17 113 23 107 37 73

Attachment 4.3, page 2 contains miscellaneous correlated balanced series {ai, i = 1 ... 4} and {bj, j = 1 ... 4).

Attachment 4.3.2 contains the resulting Prime Number Pan Magic Squares and related Magic Sums (Sm).

Each square shown corresponds with  384 Prime Number Pan Magic Squares.

4.3.3 Associated Magic Squares

When the elements {ai, i = 1 ... 4} and {bj, j = 1 ... 4) of a valid pair of Orthogonal Squares (A, B) - as applied in Section 4.2.3 above - comply with following conditions:

• mij = ai + bj = prime for i = 1 ... 4 and j = 1 ... 4 (correlated)
• a1 + a4 = a2 + a3 and b1 + b4 = b2 + b3               (balanced)

the resulting square M = A + B will be an order 4 Prime Number Associated Magic Square:

Sa = 36
 17 11 7 1 1 7 11 17 1 7 11 17 17 11 7 1
Sb = 204
 96 6 6 96 72 30 30 72 30 72 72 30 6 96 96 6
Sm = 240
 113 17 13 97 73 37 41 89 31 79 83 47 23 107 103 7

Attachment 4.3, page 2 contains miscellaneous correlated balanced series {ai, i = 1 ... 4} and {bj, j = 1 ... 4).

Attachment 4.3.3 contains the resulting Prime Number Associated Magic Squares and related Magic Sums (Sm).

Each square shown corresponds with  384 Prime Number Associated Magic Squares.

4.4   Summary

The obtained results regarding the order 4 Latin - and related Magic Squares, as deducted and discussed in previous sections, are summarized in following table:

 Attachment Subject Subroutine Latin Squares Latin Diagonal Squares Euler Squares Simple Magic Squares Pan Magic Squares Associated Magic Squares Correlated Magic Series - Prime Number Simple Magic Squares Prime Number Pan Magic Squares Prime Number Associated Magic Squares

Comparable methods as described above, can be used to construct order 5 Latin - and related (Pan) Magic Squares, which will be described in following sections.