Sie sind auf Seite 1von 6

Magic Squares -2

Karanam Ramakumar
India

Revised document on Magic Squares of N X N grid where N is always odd.


To construct a magic square, filling the cells in the grid has to be done in a methodical manner. Let us take an example
of 5 x 5 grid (n = 5). We have to fill the numbers 1 to 25 in the cells of the grid. The sequence of filling is shown below:

D-1 C-1 C-2 C-3 C-4 C-5 65

Start 8
R-1 17 24 1 15 65

R-2 23 5 7 14 16 65

20
R-3 4 6 13 22 65

3
R-4 10 12 19 21 65

25 9
R-5 11 18 2 65
End

D-2 65 65 65 65 65 65

1. Start from the first row middle cell. Write 1 there.


2. Then come to the last row and shift to the adjacent cell on right. Write 2 there.
3. Then proceed diagonally to right filling each cell with subsequent numbers until you come to the right edge.
4. Proceed to the first cell of the same row on the left edge and go up to the next higher cell in the same column. Write
the next number.
5. Proceed diagonally to right filling each cell with subsequent numbers until you come to a filled cell.
6. Come down by one cell and write the next number.
7. Again proceed diagonally to right filling each cell with subsequent numbers until you come to a filled cell or the top
edge.
8. If it is a filled cell repeat the steps 6 and 7.
9. If it is the cell in the first row AND NOT the last cell in the first row, come to the last row and shift to the adjacent
cell on right. Write the next number there. Repeat the steps 3 onwards.
10.If it is the last cell of the first row, come down by one cell and write the next number. Go to the first cell of the same
row on the left edge and go up to the next higher cell in the same column. Write the next number.
11.Repeat the steps 2 onwards until you exhaust all the grids.

If you have filled all the cells correctly, you will notice that the last number will be in the same column as the first
number (middle cell of the last row). The middle number will always be average of the first and last numbers of the
row, column or diagonal containing the middle cell.
Definition of terminologies
Grid is N X N grid where N is called the order of the grid and is always an odd number. For example, a 5 X 5 grid has
the order N =5; 7 X 7 grid has the order N = 7 and so on.
Starting number = S
Central number = C
Arithmetic difference between two successive numbers = D. The value of D must be same for a given grid square.
Total along a row, column or diagonal = T
The N X N grid magic square can be constructed with any starting number S.
The total along any row, column or diagonal is same and is always a multiple of the order N of the N X N grid.
Central number C in the N X N grid is always T/N
Starting number of the N X N grid = S = C – [D(N2 – 1)/2] and ending number = C + [D(N2 – 1)/2]
This procedure is applicable to any grid of N X N square where N is odd. We take a 5 X 5 grid as an example.

Examples
Let us consider a 5 X 5 grid square. Here N = 5.
Let the starting number S = 1 and the arithmetic difference D =1
Then the central number C = S + [D(N2 – 1)/2] = 1 + [1(52 – 1)/2] = 1 + 12 = 13
Total = C X N = 13 X 5 = 65 Note total 65 is a multiple of 5 which is the order N of the grid N X N .

Construction of the magic squares


Method-1: If the total number T, the order of the grid N in the N X N grid and the arithmetic difference D are given
1. Check if T is a multiple of N that is check if T is divisibly by N with remainder zero. If the remainder is zero, then
magic square with whole numbers can be constructed. Otherwise it is not.
2. If the magic square is possible, then find the central number C = T/N
3. Find the starting number S = C – D[(N2-1)/2]
4. Start filling the numbers as explained above.

Example – 1
Grid 5 X 5; order 5; Total T = 300 and D = 1
The total T is a multiple of 5. Hence magic square is possible.
Central number C = T/N =300/5 =60
Starting number S = C – D[(N2-1)/2]= 60 – 1 X [(52-1)/2] = 60 – 12 = 48
Ending number = C + D[(N2-1)/2] = 60 + 1 X [(52-1)/2] = 60 + 12 = 72

D-1 C-1 C-2 C-3 C-4 C-5 300

R-1 64 71 48 55 62 300

R-2 70 52 54 61 63 300

R-3 51 53 60 67 69 300

R-4 57 59 66 68 50 300

R-5 58 65 72 49 56 300

D-2 300 300 300 300 300 300

Example – 2
Grid 5 X 5; order 5; Total T = 300 and D = 2
The total T is a multiple of 5. Hence magic square is possible.
Central number C = T/N =300/5 =60
Starting number S = C – D[(N2-1)/2]= 60 – 2 X [(52-1)/2] = 60 – 24 = 36
Ending number = C + D[(N2-1)/2] = 60 + 2 X [(52-1)/2] = 60 + 24 = 84

D-1 C-1 C-2 C-3 C-4 C-5 300

R-1 68 82 36 50 64 300

R-2 80 44 48 62 66 300

R-3 42 46 60 74 78 300

R-4 54 58 72 76 40 300

R-5 56 70 84 38 52 300

D-2 300 300 300 300 300 300

Example – 3
Grid 5 X 5; order 5; Total T = 300 and D = 5
The total T is a multiple of 5. Hence magic square is possible.
Central number C = T/N =300/5 =60
Starting number S = C – D[(N2-1)/2]= 60 – 5 X [(52-1)/2] = 60 – 60 = 0
Ending number = C + D[(N2-1)/2] = 60 + 5 X [(52-1)/2] = 60 + 60 = 120

D-1 C-1 C-2 C-3 C-4 C-5 300

R-1 80 115 0 35 70 300

R-2 110 20 30 65 75 300

R-3 15 25 60 95 105 300

R-4 45 55 90 100 10 300

R-5 50 85 120 5 40 300

D-2 300 300 300 300 300 300

Example – 4
Grid 5 X 5; order 5; Total T = 300 and D = 10
The total T is a multiple of 5. Hence magic square is possible.
Central number C = T/N =300/5 =60
Starting number S = C – D[(N2-1)/2]= 60 – 10 X [(52-1)/2] = 60 – 120 = -60
Ending number = C + D[(N2-1)/2] = 60 + 10 X [(52-1)/2] = 60 + 120 = 180
D-1 C-1 C-2 C-3 C-4 C-5 300

R-1 100 170 -60 10 80 300

R-2 160 -20 0 70 90 300

R-3 -30 -10 60 130 150 300

R-4 30 50 120 140 -40 300

R-5 40 110 180 -50 20 300

D-2 300 300 300 300 300 300

Method-2: Starting number S, Grid order N and the arithmetic difference D are given
Example-5: S = 1; N = 5 and D = 1
Starting number S =1
Central number C = S + [D(N2 – 1)/2] = 1 + [1(52 – 1)/2] = 1 + 12 = 13
Total T = C X N = 13 X 5 = 65
Ending number = C + D[(N2-1)/2] = 13 + 1 X [(52-1)/2] = 13 + 12 = 25

D-1 C-1 C-2 C-3 C-4 C-5 65

R-1 17 24 1 8 15 65

R-2 23 5 7 14 16 65

R-3 4 6 13 20 22 65

R-4 10 12 19 21 3 65

R-5 11 18 25 2 9 65

D-2 65 65 65 65 65 65
Example-6: S = 5; N = 5 and D = 3
Starting number S =5
Central number C = S + [D(N2 – 1)/2] = 5 + [3(52 – 1)/2] = 5 + 36 = 41
Total T = C X N = 41 X 5 = 205
Ending number = C + D[(N2-1)/2] = 41 + 3 X [(52-1)/2] = 41 + 36 = 77

D-1 C-1 C-2 C-3 C-4 C-5 205

R-1 53 74 5 26 47 205

R-2 71 17 23 44 50 205

R-3 14 20 41 62 68 205

R-4 32 38 59 65 11 205

R-5 35 56 77 8 29 205

D-2 205 205 205 205 205 205

Example-7: S = 10; N = 5 and D = -10


Starting number S =10
Central number C = S + [D(N2 – 1)/2] = 10 + [-10(52 – 1)/2] = 10 - 120 = -110
Total T = C X N = -110 X 5 = -550
Ending number = C + D[(N2-1)/2] = -110 + (-10) X [(52-1)/2] = -110 - 120 = -230

D-1 C-1 C-2 C-3 C-4 C-5 -550

R-1 -150 -220 10 -60 -130 -550

R-2 -210 -30 -50 -120 -140 -550

R-3 -20 -40 -110 -180 -200 -550

R-4 -80 -100 -170 -190 -10 -550

R-5 -90 -160 -230 0 -70 -550

D-2 -550 -550 -550 -550 -550 -550

Example-8: S = -12; N = 5 and D = 1


Starting number S =-12
Central number C = S + [D(N2 – 1)/2] = -12 + [1(52 – 1)/2] = -12 + 12 = 0
Total T = C X N = 0 X 5 = 0
Ending number = C + D[(N2-1)/2] = 0 + 1 X [(52-1)/2] = 0 + 12 = 12
D-1 C-1 C-2 C-3 C-4 C-5 0

R-1 4 11 -12 -5 2 0

R-2 10 -8 -6 1 3 0

R-3 -9 -7 0 7 9 0

R-4 -3 -1 6 8 -10 0

R-5 -2 5 12 -11 -4 0

D-2 0 0 0 0 0 0

Das könnte Ihnen auch gefallen