Monday 21 September 2020

Magic Squares

This post was inspired by my daily number analysis of my diurnal age. I was struggling to find something of interest about 26102 when I discovered that a \(4 \times 4 \) magic square could be created in which 26102 was the magic constant. This got me thinking about what numbers could be represented in this way as magic squares.

A \(n \times n \) magic square has its \(n^2\) cells filled with the numbers from \(1 \text{ to } n^2 \) in such a way that the sums of all rows, columns and main diagonals are the same. This sum is called the magic constant:$$ \frac{n(n^2+1)}{2}$$The \(3 \times 3 \) magic square contains the numbers from 1 to 9 and all rows, columns and main diagonals add up to 15. Thus the magic constant is 15.$$


\begin{array}{|c|c|c|}

\hline 8 & 1 & 6 \\

\hline 3 & 5 & 7\\

\hline 4 & 9 & 2 \\

\hline

\end{array}

$$If we add 1 to each element of the above magic square, we get the next magic square and this has a magic constant of 18:$$\begin{array}{|c|c|c|}

\hline 9 & 2 & 7 \\

\hline 4 & 6 & 8\\

\hline 5 & 10 & 3 \\

\hline

\end{array}$$All subsequent \(3 \times 3 \) magic squares will have magic constants that are multiples of 3. Thus the number 26097 = 3 x 8699 can be represented as:$$\begin{array}{|c|c|c|}

\hline 8702 & 8695 & 8700 \\

\hline 8697 & 8699 & 8701\\

\hline 58698 & 8703 & 8696 \\

\hline

\end{array}$$We could represent the various matrices in terms of a subscript for their size and a superscript for their magic sum. This is purely my own invention but it means we would have: M\(_3^{15}\)M\(_3^{18}\) and M\(_3^{26097} \) where M is any matrix that satisfies the condition of being magic and having a particular size and magic sum. The \(4 \times 4\) magic square containing the numbers 1 to 15 has a magic sum of 34:$$\begin{array}{|c|c|c|c|}

\hline 16 & 2 & 3 & 13 \\

\hline 5 & 11 & 10 & 8\\

\hline 9 & 7 & 6 & 12 \\


\hline 4 & 14 & 15 & 1 \\

\hline

\end{array}$$It would be designated as M\(_4^{34}\) in my system. The subsequent magic sums that are possible are 38, 42, 46, 50 and so on. To test whether a number can be the magic constant for a \(4 \times 4\) magic square, simply subtract 34 from the number and test whether the result is divisible by 4. In the case of 26102, it is and so we have:$$\begin{array}{|c|c|c|c|}\hline 6533 & 6519 & 6520 & 6530 \\


\hline 6522 & 6528 & 6527 & 6525\\

\hline 6526 & 6524 & 6523 & 6529 \\


\hline 6521 & 6531 & 6532 & 6518 \\

\hline

\end{array}$$This magic square can be designated M\(_4^{26102}\). Figures 1 and 2 shows the magic squares together with their magic sums and associated planet or luminary.

Figure 1: source


Figure 2: source

The \(5 \times 5 \) magic square has a constant of 65 and so any subsequent multiples of 5 will be representable as \(5 \times 5 \) magic squares. The \(6 \times 6 \) magic square has a constant of 111 which is 3 x 37. This means that 117, 123, 129 etc. can be represented as \(6 \times 6 \) magic squares but these numbers are not multiples of 6. To determine whether a number can be the magic constant for a \(6 \times 6 \) magic square, the 111 must first be subtracted and the result tested for divisibility by 6. This is like the \(4 \times 4 \) case.

For the \(7 \times 7 \) magic square, the constant is 175 = 7 x 25 and so any multiple of 7 can be represented by a \(7 \times 7 \) magic square. For the \(8 \times 8 \) magic square, the constant is 260 = 4 x 65 which is not divisible by 8 and the situation is as the same as with 4 and 6. For the \(9 \times 9 \) magic square, the constant is 369 = 9 x 41 so all multiples of 9 above 369 qualify.

Figure 3 shows the magic constants for larger magic squares:


Figure 3: source

So generally, excluding 2, the prime factorisation of a number will quickly tell us what magic squares it can serve as a constant for. For example, 910 = 2 * 5 * 7 * 13 and so it can be represented by magic squares of side 5, 7 and 13. It can also be represented as a magic square with a composite number of sides but a little testing is required. For example, it can be represented as a \(4 \times 4 \) magic square but not \(8 \times 8 \). This site is great for such testing.

on May 14th 2021

No comments:

Post a Comment