Magic squares





Mesosyn method for constructing singly even order (4N + 2) magic squares (e.g. 6, 10, 14, 18,····).

There are many ways to construct magic squares, but the standard (and most simple) way is to follow certain configurations/formulas which generate regular patterns. Magic squares exist for all values of n, with only one exception: it is impossible to construct a magic square of order 2 (2x2)
. Magic squares can be classified into three types: odd, doubly even (n divisible by four) and singly even (n even, but not divisible by four).
Odd magic squares are fairly easily constructed using the either the Siamese (sometimes called the de la Loubere's, or the Staircase), the Lozenge, or the de Meziriac's methods.
Doubly even magic squares are also easy to generate.
The construction of singly even magic squares is more difficult but several methods exist, including the LUX method for magic squares (due to John Horton Conway) and the Strachey method for magic squares. These established methods for creating singly even order magic squqres are not quite elegant as for odd order and doubly-even magic square in the sense that the methods are non-symmetrical and are largely empirical.

We have developed a method for constructing magic squares of singly even order in a more systemic way.

This method requires specific exchanges between a symmetrical group of four numbers:

1) a Z-shape 4-way exchange between the four symmetrical numbers.
2) a l⁄l-shape 4-way exchange between the four symmetrical numbers. l⁄l is actually an inverted N and we simply pronounce it N.
3) an — directon or I direction 2-way interchange between a pair symmetrical numbers located in the same row or in the same column.
Here we just call them the pairs and — is used to indicate the interchange between a symmetrical pair in the same row
and I is used to indicate the interchange between a symmetrical pair in the same column.
4) an '0' is used to indicate that 4 symmetrical numbers are retained in the same places without any exchange.

This method will be demonstrated by contructing a 6x6 normal magic square.

6x6 matrix
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
4-way exchange
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
4-way exchange
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
Magic square

Magic square

↓↓
1 35 3 4 2 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 5 33 34 32 36
↓↓
1 2 3 4 5 6
7 8 9 10 11 12
13 23 15 16 14 18
19 17 21 22 20 24
25 26 27 28 29 30
31 32 33 34 35 36
↓↓
1 35 3 4 32 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 2 33 34 5 36
↓↓
1 2 3 4 5 6
7 8 9 10 11 12
13 23 15 16 20 18
19 14 21 22 17 24
25 26 27 28 29 30
31 32 33 34 35 36


In summary, the sequences of 4-way exchange are as follows:
In Z-type exchange, the number originally located in Z1 is moved to Z2, which is move to Z3, which is moved to Z4 and which, in turn, is moved to Z1.
In l⁄l-type exchange, the number originally located in l⁄l1 is moved to l⁄l2, which is move to l⁄l3, which is moved to l⁄l4 and which, in turn, is moved to l⁄l1.

6x6 matrix
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
Z-type exchange
  Z1 Z1 Z2 Z2  
Z1   z1 z2   Z2
Z1 z1     z2 Z2
Z3 z3     z4 Z4
Z3   z3 z4   Z4
  Z3 Z3 Z4 Z4  
l⁄l-type exchange
  l⁄l1 l⁄l1 l⁄l3 l⁄l3  
l⁄l1   l⁄l1 l⁄l3   l⁄l3
l⁄l1 l⁄l1     l⁄l3 l⁄l3
l⁄l2 l⁄l2     l⁄l4 l⁄l4
l⁄l2   l⁄l2 l⁄l4   l⁄l4
  l⁄l2 l⁄l2 l⁄l4 l⁄l4  






Mesosyn method for constructing a 6x6 magic square.

The sum of each row, column and diagonal is 111, the “magic number” for a 6 × 6 magic square.

First example

Step 1: All the numbers are written in the order from left to right across each row in turn, starting from the top left hand corner.
Those numbers (in brown color) on the diagonals are retained in the same place.
Enter the number of high-value numbers (19-36) in each row.
Enter the number of higher-value numbers in each column.
The higher-value numbers are the ones with higher value when compared with their symmetrical numbers in the same rows.
For examples, 6>1, 4>3, 10>9, 16>15, 24>19, 29>26 and 34>33.
In a group of 4 symmetrical numbers (for example,7,12,25, and 30), 12 and 30 are counted as higher-value numbers.
Exchange code is the sequence of exchanges you are planning to use to construct the magic square.
Whether the code will work or not can be checked in step 2, the work sheet.
Step 2: Enter the codes into their respective starting positions (Z1 or l⁄l1 positions).
To calculate the number of high-value numbers for each row, Z is counted as 1 since a Z-shape 4-way exchange will bring only one high-value numbers (19-36) into Z1 position;
l⁄l is counted as 2 since a l⁄l-shape 4-way exchange will bring two high-value numbers to the row into l⁄l1 and l⁄l3 positions;
is counted as 0 and I is counted as 1.
To calculate the number of higher-value numbers for each column, Z is counted as 2 since it will bring two higher symmetrical value to the column into Z1 and Z3 positions;
l⁄l is counted as 1 since since it will bring only one higher symmetrical value into l⁄l1 position.
I is counted as 0 and is counted as 1.
If the code is working, then there will be equal number of high-value numbers in each row and equal number of higher-value numbers in each column.
(You only need to check the first 3 rows and first 3 columns.)

step 1
Exchange
code →
     Rows: Zl⁄l Z
Columns: l⁄lZ l⁄l
High-value
numbers
(19-36)
  1 2 3 4 5 6 0
  7 8 9 10 11 12 0
  14 13 15 16 17 18 0
  19 20 21 22 23 24 6
  25 26 27 28 29 30 6
  31 32 33 34 35 36 6
Higher-value
numbers
0 0 0 6 6 6  
step 2: Work sheet
Exchange
code →
     Rows: Zl⁄l Z
Columns: l⁄lZ l⁄l
High-value
numbers
(19-36)
    Z l⁄l             3
  l⁄l   Z       3
  Z l⁄l         3
               
               
               
Higher-value
numbers
3 3 3        


Step 3: First exchange: a Z-type exchange between a group of 4 symmetrical numbers (2,5,32,and 35)
and a l⁄l-type exchange between a group of 4 symmetrical numbers (7,12,25,and 30)
Step 4: Second exchange: a l⁄l-type exchange between a group of 4 symmetrical numbers (3,4,33,and 34)
and a Z-type exchange between a group of 4 symmetrical numbers (13,18,19,and 24)
Step 5: Third exchange: a Z-type exchange between a group of 4 symmetrical numbers (9,10,27,and 28)
and a l⁄l-type exchange between a group of 4 symmetrical numbers (14,17,20,and 23)

step 3
First
Exchange
     Rows: Zl⁄l Z
Columns: l⁄lZ l⁄l
Total
  1 35 3 4 2 6  
  30 8 9 10 11 25  
  13 14 15 16 17 18  
  19 20 21 22 23 24  
  7 26 27 28 29 12  
  31 5 33 34 32 36  
Total              
step 4
Second
Exchange
      Rows: Zl⁄l Z
Columns: l⁄lZ l⁄l
Total
  1 35 34 33 2 6 111
  30 8 9 10 11 25  
  24 14 15 16 17 13  
  18 20 21 22 23 19  
  7 26 27 28 29 12  
  31 5 3 4 32 36 111
Total 111         111  
step 5
Third
Exchange
     Rows: Zl⁄l Z
Columns: l⁄lZ l⁄l
Total
  1 35 34 33 2 6 111
  30 8 28 9 11 25 111
  24 23 15 16 20 13 111
  18 14 21 22 17 19 111
  7 26 10 27 29 12 111
  31 5 3 4 32 36 111
Total 111 111 111 111 111 111  



Second example

step 1
Exchange
code →
      Rows: l⁄lZ l⁄l
Columns: Zl⁄l Z
High-value
numbers
(19-36)
  1 2 3 4 5 6 0
  7 8 9 10 11 12 0
  14 13 15 16 17 18 0
  19 20 21 22 23 24 6
  25 26 27 28 29 30 6
  31 32 33 34 35 36 6
Higher-value
numbers
0 0 0 6 6 6  
step 2: Work sheet
Exchange
code →
      Rows: l⁄lZ l⁄l
Columns: Zl⁄l Z
High-value
numbers
(19-36)
    l⁄l Z             3
  Z   l⁄l       3
  l⁄l Z         3
               
               
               
Higher-value
numbers
3 3 3        
step 3
First
Exchange
      Rows: l⁄lZ l⁄l
Columns: Zl⁄l Z
Total
  1 35 3 4 32 6  
  30 8 9 10 11 7  
  13 14 15 16 17 18  
  19 20 21 22 23 24  
  12 26 27 28 29 25  
  31 2 33 34 5 36  
Total              
step 4
Second
Exchange
      Rows: l⁄lZ l⁄l
Columns: Zl⁄l Z
Total
  1 35 34 3 32 6 111
  30 8 9 10 11 7  
  24 14 15 16 17 19  
  13 20 21 22 23 18  
  12 26 27 28 29 25  
  31 2 4 33 5 36 111
Total 111         111  
step 5
Third
Exchange
      Rows: l⁄lZ l⁄l
Columns: Zl⁄l Z
Total
  1 35 34 3 32 6 111
  30 8 28 27 11 7 111
  24 23 15 16 14 19 111
  13 17 21 22 20 18 111
  12 26 9 10 29 25 111
  31 2 4 33 5 36 111
Total 111 111 111 111 111 111  










Mesosyn method for constructing a 10x10 magic square.

The sum of each row, column and diagonal is 505, the “magic number” for a 10 × 10 magic square.

step 1
Exchange
code →
    Rows: l⁄lZZZ Zl⁄lZ Z0 −
Columns: Zl⁄ll⁄ll⁄l l⁄lZl⁄l l⁄l0 I
High-value
numbers
(51-100)
  1 2 3 4 5 6 7 8 9 10 0
  11 12 13 14 15 16 17 18 19 20 0
  21 22 23 24 25 26 27 28 29 30 0
  31 32 33 34 35 36 37 38 39 40 0
  41 42 43 44 45 46 47 48 49 50 0
  51 52 53 54 55 56 57 58 59 60 10
  61 62 63 64 65 66 67 68 69 70 10
  71 72 73 74 75 76 77 78 79 80 10
  81 82 83 84 85 86 87 88 89 90 10
  91 92 93 94 95 96 97 98 99 100 10
Higher-value
numbers
0 0 0 0 0 10 10 10 10 10  
step 2: Work sheet
Exchange
code →
    Rows: l⁄lZZZ Zl⁄lZ Z0 −
Columns: Zl⁄ll⁄ll⁄l l⁄lZl⁄l l⁄l0 I
High-value
numbers
(51-100)
  1 l⁄l Z Z Z 6 7 8 9 10 5
  Z 12 Z l⁄l Z 16 17 18 19 20 5
  l⁄l l⁄l 23 Z 0 26 27 28 29 30 5
  l⁄l Z l⁄l 34 36 37 38 39 40 5
  l⁄l l⁄l 0 I 45 46 47 48 49 50 5
  51 52 53 54 55 56 57 58 59 60  
  61 62 63 64 65 66 67 68 69 70  
  71 72 73 74 75 76 77 78 79 80  
  81 82 83 84 85 86 87 88 89 90  
  91 92 93 94 95 96 97 98 99 100  
Higher-value
numbers
5 5 5 5 5            
step 3
First exchange
(Outer layer)
      Rows: l⁄lZZZ Zl⁄lZ Z0 −
Columns: Zl⁄ll⁄ll⁄l l⁄lZl⁄l l⁄l0 I
Total
  1 99 98 (97) 96 5 (4) 3 92 10 505
  90 12 13 14 15 16 17 18 19 11  
  80 22 23 24 25 26 27 28 29 71  
  (70) 32 33 34 35 36 37 38 39 (61)  
  60 42 43 44 45 46 47 48 49 51  
  41 52 53 54 55 56 57 58 59 50  
  (31) 62 63 64 65 66 67 68 69 (40)  
  21 72 73 74 75 76 77 78 79 30  
  20 82 83 84 85 86 87 88 89 81  
  91 2 8 (7) 6 95 (94) 93 9 100 505
Total 505                 505  
↓↓

Concentric magic square
Exchange
code →
     Rows: l⁄lZZZ + 4 interchanges
Columns: Zl⁄ll⁄ll⁄l + 4 interchanges
Total
  1 99 98 97 96 5 4 3 92 10 505
  90 12 13 14 15 16 17 18 19 11  
  80 22   29 71 505
  70 32 6x6 magic core 39 61 505
  60 42 Magic number 49 51 505
  41 52 || 59 50 505
  31 62 303 69 40 505
  21 72   79 30 505
  20 82 83 84 85 86 87 88 89 81  
  91 2 8 7 6 95 94 93 9 100 505
Total 505   505 505 505 505 505 505   505  
↓↓
step 4
Second exchange
(Second layer)
     Rows: l⁄lZZZ Zl⁄lZ Z0 −
Columns: Zl⁄ll⁄ll⁄l l⁄lZl⁄l l⁄l0 I
Total
  1 99 98 97 96 5 4 3 92 10 505
  90 12 (88) 87 86 15 84 (13) 19 11 505
  80 (79) 23 24 25 26 27 28 (72) 71  
  70 69 33 34 35 36 37 38 32 61  
  60 59 43 44 45 46 47 48 52 51  
  41 42 53 54 55 56 57 58 49 50  
  31 39 63 64 65 66 67 68 62 40  
  21 (22) 73 74 75 76 77 78 (29) 30  
  20 82 (18) 14 16 85 17 (83) 89 81 505
  91 2 8 7 6 95 94 93 9 100 505
Total 505 505             505 505  
↓↓
    
Concentric magic square
Exchange
code →
     Rows: l⁄lZZZ + 4 interchanges
Columns: Zl⁄ll⁄ll⁄l + 4 interchanges
Total
  1 99 98 97 96 5 4 3 92 10 505
  90 12 13 84 85 86 87 18 19 11 505
  80 22   29 71 505
  70 39 6x6 magic core 32 61 505
  60 49 Magic number 42 51 505
  41 59 || 52 50 505
  31 69 303 62 40 505
  21 72   79 30 505
  20 82 83 14 15 16 17 88 89 81 505
  91 2 8 7 6 95 94 93 9 100 505
Total 505 505 505 505 505 505 505 505 505 505  
↓↓
step 5
Third exchange
(Third layer)
     Rows: l⁄lZZZ Zl⁄lZ Z0 −
Columns: Zl⁄ll⁄ll⁄l l⁄lZl⁄l l⁄l0 I
Total
  1 99 98 97 96 5 4 3 92 10 505
  90 12 88 87 86 15 84 13 19 11 505
  80 79 23 (77) 25 26 (24) 28 72 71 505
  70 69 (68) 34 35 36 37 (63) 32 61 505
  60 59 43 44 45 46 47 48 52 51 505 -10
  41 42 53 54 55 56 57 58 49 50 505 +10
  31 39 (33) 64 65 66 67 (38) 62 40 505
  21 22 73 (27) 75 76 (74) 78 29 30 505
  20 82 18 14 16 85 17 83 89 81 505
  91 2 8 7 6 95 94 93 9 100 505
Total 505 505 505 505 -1 +1 505 505 505 505  
↓↓
    
6x6 core matrix
Exchange
code→
     Rows: l⁄lZ l⁄l
Columns: Zl⁄l Z
Total
                                   
    303             303    
      23 24 25 26 27 28      
      33 34 35 36 37 38      
      43 44 45 46 47 48      
      53 54 55 56 57 58      
      63 64 65 66 67 68      
      73 74 75 76 77 78      
    303             303    
                       
Total                      
↓↓
step 6
Final 2-way
interchanges
      Rows: l⁄lZZZ Zl⁄lZ Z0 −
Columns: Zl⁄ll⁄ll⁄l l⁄lZl⁄l l⁄l0 I
Total
  1 99 98 97 96 5 4 3 92 10 505
  90 12 88 87 86 15 84 13 19 11 505
  80 79 23 77 25 26 24 28 72 71 505
  70 69 68 34 (36) (35) 37 63 32 61 505
  60 59 43 (54) 45 46 47 48 52 51 505
  41 42 53 (44) 55 56 57 58 49 50 505
  31 39 33 64 65 66 67 38 62 40 505
  21 22 73 27 75 76 74 78 29 30 505
  20 82 18 14 16 85 17 83 89 81 505
  91 2 8 7 6 95 94 93 9 100 505
Total 505 505 505 505 505 505 505 505 505 505  
↓↓
    
Step 1 ( 6x6 core )
First exchange
(Outer Layer)
     Rows: l⁄lZ l⁄l
Columns: Zl⁄l Z
Total
                                   
    303             303    
      23 77 76 25 74 28     303
      68 34 35 36 37 33      
      58 44 45 46 47 53      
      43 54 55 56 57 48      
      38 64 65 66 67 63      
      73 24 26 75 27 78     303
    303             303    
                       
Total     303         303      
↓↓
10 X 10 Magic square
Exchange
code →
      Rows: l⁄lZZZ Zl⁄lZ Z0 −
Columns: Zl⁄ll⁄ll⁄l l⁄lZl⁄l l⁄l0 I
Total
  1 99 98 97 96 5 4 3 92 10 505
  90 12 88 87 86 15 84 13 19 11 505
  80 79 23 77 25 26 24 28 72 71 505
  70 69 68 34 36 35 37 63 32 61 505
  60 59 43 54 45 46 47 48 52 51 505
  41 42 53 44 55 56 57 58 49 50 505
  31 39 33 64 65 66 67 38 62 40 505
  21 22 73 27 75 76 74 78 29 30 505
  20 82 18 14 16 85 17 83 89 81 505
  91 2 8 7 6 95 94 93 9 100 505
Total 505 505 505 505 505 505 505 505 505 505  
    
Step 2 ( 6x6 Magic core )
Second exchange
(Second Layer)
     Rows: l⁄lZ l⁄l
Columns: Zl⁄l Z
Total
                                   
    303             303    
      23 77 76 25 74 28     303
      68 34 66 65 37 33     303
      58 57 45 46 44 53     303
      43 47 55 56 54 48     303
      38 64 35 36 67 63     303
      73 24 26 75 27 78     303
    303             303    
                       
Total     303 303 303 303 303 303      















Mesosyn method for constructing doubly even order (4N + 4) magic squares (e.g. 8, 12, 16, 20,····).



Mesosyn method for constructing a 8 x 8 magic square.

The sum of each row, column and diagonal is 260, the “magic number” for a 8 × 8 magic square.

step 1
Exchange
code →
    Rows: ZZl⁄l l⁄l0 Z
Columns: l⁄ll⁄lZ Z0 l⁄l
High-value
numbers
(33-64)
  1 2 3 4 5 6 7 8 0
  9 10 11 12 13 14 15 16 0
  17 18 19 20 21 22 23 24 0
  25 26 27 28 29 30 31 32 0
  33 34 35 36 37 38 39 40 8
  41 42 43 44 45 46 47 48 8
  49 50 51 52 53 54 55 56 8
  57 58 59 60 61 62 63 64 8
Higher-value
numbers
0 0 0 0 8 8 8 8  
step 2: Work sheet
Exchange
code →
    Rows: ZZl⁄l l⁄l0 Z
Columns: l⁄ll⁄lZ Z0 l⁄l
High-value
numbers
(33-64)
  1 Z Z l⁄l 5 6 7 8 4
  l⁄l 10 l⁄l 13 14 15 16 4
  l⁄l Z 19 Z 21 22 23 24 4
  Z I l⁄l 28 29 30 31 32 4
  33 34 35 36 37 38 39 40  
  41 42 43 44 45 46 47 48  
  49 50 51 52 53 54 55 56  
  57 58 59 60 61 62 63 64  
Higher-value
numbers
4 4 4 4          
step 3
First exchange
(Outer layer)
     Rows: ZZl⁄l l⁄l0 Z
Columns: l⁄ll⁄lZ Z0 l⁄l
Total
  1 63 62 61 60 3 2 8 260
  56 10 11 12 13 14 15 49  
  48 18 19 20 21 22 23 41  
  40 26 27 28 29 30 31 25  
  32 34 35 36 37 38 39 33  
  17 42 43 44 45 46 47 42  
  9 50 51 52 53 54 55 16  
  57 7 6 4 5 59 58 64 260
Total 260             260  
step 4
Second exchange
(Second layer)
     Rows: ZZl⁄l l⁄l0 Z
Columns: l⁄ll⁄lZ Z0 l⁄l
Total
  1 63 62 61 60 3 2 8 260
  56 10 54 12 13 51 15 49 260
  48 47 19 20 21 22 18 41  
  40 26 27 28 29 30 31 25  
  32 34 35 36 37 38 39 33  
  17 23 43 44 45 46 42 42  
  9 50 11 52 53 14 55 16 260
  57 7 6 4 5 59 58 64 260
Total 260 260         260 260  
step 5
Third exchange
(Third layer)
     Rows: ZZl⁄l l⁄l0 Z
Columns: l⁄ll⁄lZ Z0 l⁄l
Total
  1 63 62 61 60 3 2 8 260
  56 10 54 12 13 51 15 49 260
  48 47 19 45 20 22 18 41 260
  40 26 38 28 29 35 31 25 260-8
  32 34 27 36 37 30 39 33 260+8
  17 23 43 21 44 46 42 24 260
  9 50 11 52 53 14 55 16 260
  57 7 6 4 5 59 58 64 260
Total 260 260 260 -1 +1 260 260 260  
step 6
Third exchange
(Third layer)
     Rows: ZZl⁄l l⁄l0 Z + 1 interchange
Columns: l⁄ll⁄lZ Z0 l⁄l + 1 interchange
Total
  1 63 62 61 60 3 2 8 260
  56 10 54 13 12 51 15 49 260
  48 47 19 45 20 22 18 41 260
  40 34 38 28 29 35 31 25 260
  32 26 27 36 37 30 39 33 260
  17 23 43 21 44 46 42 24 260
  9 50 11 52 53 14 55 16 260
  57 7 6 4 5 59 58 64 260
Total 260 260 260 260 260 260 260 260  
8x8 Magic Square
Exchange
code →
      Rows: ZZl⁄l l⁄l− Z 
Columns: l⁄ll⁄lZ ZI l⁄l 
Total
  1 63 62 61 60 3 2 8 260
  56 10 54 13 12 51 15 49 260
  48 47 19 45 20 22 18 41 260
  40 34 38 28 29 35 31 25 260
  32 26 27 36 37 30 39 33 260
  17 23 43 21 44 46 42 24 260
  9 50 11 52 53 14 55 16 260
  57 7 6 4 5 59 58 64 260
Total 260 260 260 260 260 260 260 260