Nested Magic Squares
by Robert C. Wilke
5 x 5 Nested Magic Square
Traditionally, a magic square consists of a set of consecutive numbers such that the rows, columns, and diagonals add up to the same number. A nested magic square is defined as magic square which contains a magic square of smaller order. For example,
A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
| K | L |
M |
N |
O |
P |
Q |
R |
S |
T |
U |
V |
W |
X |
Y |
If the above square is magic and nested then the square with the corners G, I, Q, S, will also be magic. Since the nested square has certain properties, then the outer ring, A, B, C, D, E, J, O, T, Y, X, W, V, U, P, K, F can be worked on independently from the inner magic square, greatly reducing the number of calculations required to determine the total number of nested magic 5 x 5 squares.
Choosing the proper value of the 3 x 3 magic square which will be nested in a 5 x 5 magic square turns out to be quite easy.
The 5 x 5 magic square by definition consists of the numbers 1 through 25, the sum of those numbers equals 325. In selecting the nested 3 x 3 magic square by definition, the smallest magic 3 x 3 square would consist of the numbers 1 to 9, and the largest 3 x 3 magic square would consist of the numbers 17 through 25 because of the consecutive number constraints imposed by the 5 x 5 magic square. It is possible to construct the following chart for the 5 x 5 magic square which only lists whole number solutions to the problem.
Sum Total 5 x 5 Square |
Sum of Nested 3 x 3 Square |
Sum of One Ros of Nested 3 x 3 Square |
5 x 5 Sum Minus 3 x 3 Sum |
Difference Divided by Eight |
Sum of One Row
3 x 3 and One Pair of Numbers 5 x 5 |
325 |
45 |
15 |
280 |
35 |
50 |
325 |
69 |
23 |
256 |
32 |
55 |
325 |
93 |
31 |
232 |
29 |
60 |
325 |
117 |
39 |
208 |
26 |
65 |
325 |
141 |
47 |
184 |
23 |
70 |
325 |
165 |
55 |
160 |
20 |
75 |
325 |
189 |
63 |
136 |
17 |
80 |
Reading across the first row of this chart you can see that the sum total of the 5 x 5 magic square will be 325. Assuming sum total for the 3 x 3 magic square equals 45 ( a magic square with the number 1 through 9), then if you divide by 3 ( the number of rows), you find that the sum of one row will be 15. If the sum for the 3 x 3 magic square of 45 is subtracted from the sum of the 5 x 5 magic square which has to be 325, the remaining balance is equal to 280. Since the 3 x 3 square is magic, then the eight sums, (A+Y, B+V, C+W, D+X, E+U, F+J, K+O, P+T) must all be equal. Therefore if you divide 280 by 8, you get the value of the sum of any of the two numbers which in this case is equal to 35. Therefore, A+Y = 35 and G+M+S = 15, so the sum of any row will be equal to 50. This is an obvious contradiction since the sum of all rows, columns and diagonals for a 5 x 5 must equal 325 divided by 5 or 65. Hence from the table it is obvious that for all nested 5 x 5 magic squares, the 3 x 3 magic square must have a row, column and diagonal total of 39.
There is only one 3 x 3 magic square which meets these conditions and also is made up of consecutive numbers. ( Note: There are actually 26 magic squares whose row, column, and diagonal total equals 39, however there is only one which consists of consecutive numbers.)
10 |
17 |
12 |
| 15 | 13 | 11 |
| 14 | 09 | 16 |
There are only ten rings which can be calculated, which will give you a nested 5 x 5 magic square using this 3 x 3 magic square base. The following nested magic squares have been ordered in the following way in order to eliminate the possibility of confusion. The magic square is written so that the lowest corner number is always placed in the upper left hand corner. Next the magic square is rotated on the diagonal A-Y so that the next smallest corner number is located in the upper right hand side. The remaining numbers in the top row are ordered in increasing value at the same time ordering the numbers in the bottom row in decreasing value such that B<C<D and V>W>X. Finally the remaining numbers on the left hand side are ordered so that F<K<P and J>O>T. Confusion and duplication will be avoided if the nested 5 x 5 magic squares are ordered in this manner.
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Each one of these 10 rings defines a family of nested 5 x 5 magic squares. When looking at the rows of numbers you will notice that if B-C, and V-W are both switched, a different unique magic square will be formed. B,C,D and V,W,X can all be switched independently giving 6 permutations. In addition F,K,P and J,O,T can also be switched independently in the same way giving 6 x 6 or 36 permutations - unique magic squares. Additionally, the 3 x 3 nested magic square can be rotated and flipped on a diagonal and rotated into 8 different positions on each of the independent permutations so that each ring allows for 6 x 6 x 8 = 288 unique magic squares. Since there are 10 rings there are a total of 2880 unique nested 5 x 5 magic squares.
7 x 7 Nested Magic Squares
Using the same methods of calculation it is also possible to quantify the total number of 7 x 7 nested magic squares. The total number of 7 x 7 rings possible is 1291. Permutations on the top and bottom row total a possible 120, and permutations on the left and right side rows also total 120. Additionally, the nested 5 x 5 magic square possibilities 2880 each can be rotated and flipped eight different ways. Therefore the total number of unique 7 x 7 nested magic squares equals 1291 x 120 x 120 x 2880 x 8 = 428,322,816,000. Below are the smallest, and largest possible 7 x 7 nested magic squares, which have been ordered in the manner described above for the 5 x 5 nested magic squares.
|
|
9 x 9 Nested Magic Squares
Using the same methods of calculation it is also possible to quantify the total number of 9 x 9 nested magic squares. The total number of 9 x 9 rings possible is 3567. Permutations on the top and bottom row total a possible 5040, and permutations on the left and right side rows also total 5040. Additionally, the nested 7 x 7 magic square possibilities 428,322,816,000 each can be rotated and flipped eight different ways.
Therefore the total number of unique 9 x 9 nested magic squares equals
3467 x 5040 x 5040 x 428,322,816,000 x 8 = 310,474,101,077,200,000,000,000. Below are the smallest, and largest possible 9 x 9 nested magic squares, which have been ordered in the manner described above for the 5 x 5 nested magic squares.
|
|
Numerical Relationships - Nested Magic Squares
The following relationships exists for all odd numbered nested magic squares.
Center Square C = ((n*n)+1)/2)
Sum of Nested 3 x 3 Row = 3 * C Sum of Nested 3 x 3 Square = 3 * 3 * C
Sum of Nested 5 x 5 Row = 5 * C Sum of Nested 3 x 3 Square = 5 * 5 * C
Sum of Nested 3 x 3 Row = 7 * C Sum of Nested 3 x 3 Square = 7 * 7 * C
Sum of Nested 3 x 3 Row = 9 * C Sum of Nested 3 x 3 Square = 9 * 9 * C
...................................................... ..................................................................
Sum of Nested 3 x 3 Row = n * C Sum of Nested 3 x 3 Square = n * n * C
For example with a 3 x 3 nested magic square:
n = 3 then C = 5, Sum of a row = 3 * 5 = 15, Sum of the square = 3 * 3 * 5 = 45
It follows that with a 5 x 5 nested magic square:
n = 5 then C = 13, Sum of a row = 5 * 13 = 65, Sum of the square = 5 * 5 * 13 = 325,
Also,
the Sum of a row of the 3 x 3 nested square = 3 * 13 = 39 and
the Sum of the nested 3 x 3 magic square = 3 * 3 * 13 = 117.
It follows that with a 7 x 7 nested magic square:
n = 7 then C = 25, Sum of a row = 7 * 25 = 175, Sum of the square = 7 * 7 * 25 = 1225,
Also,
the Sum of a row of the 3 x 3 nested square = 3 * 25 = 75 and
the Sum of the nested 3 x 3 magic square = 3 * 3 * 25 = 225.
the Sum of a row of the 5 x 5 nested square = 5 * 25 = 125 and
the Sum of the nested 5 x 5 magic square = 5 * 5 * 25 = 625.
It follows that with a 9 x 9 nested magic square:
n = 9 then C = 41, Sum of a row = 9 * 41 = 369, Sum of the square = 9 * 9 * 41 = 3321,
Also,
the Sum of a row of the 3 x 3 nested square = 3 * 41 = 123 and
the Sum of the nested 3 x 3 magic square = 3 * 3 * 41 = 369.
the Sum of a row of the 5 x 5 nested square = 5 * 41 = 205 and
the Sum of the nested 5 x 5 magic square = 5 * 5 * 41 = 1025.
the Sum of a row of the 7 x 7 nested square = 7 * 41 = 287 and
the Sum of the nested 7 x 7 magic square = 7 * 7 * 41 = 2009.
If you have any questions or comments, please e-mail me at robertw653@aol.com