# Fill 3x3 magic square with distinct numbers 1..60 summing up to 69

I have to fill a whole 3x3 grid in such a way that the sum of each row, column, and main diagonal is 69. I couldn't find any logic to fill it up. I have to use distinct numbers from 1 to 60 for this. Here's the square:

\begin{align} &x_0&x_1& &x_2\\ &y_0&y_1& &y_2\\ &z_0&z_1& &z_2 \end{align}

All values $\{x_i, y_i, z_i\}$ should be less than 60.

\left.\begin{align} x_0+y_0+z_0=69\\ x_1+y_1+z_1=69\\ x_2+y_2+z_2=69\\ \end{align}\right\}\text{columns}\\

\left.\begin{align} x_0+x_1+x_2=69\\ y_0+y_1+y_2=69\\ z_0+z_1+z_2=69\\ \end{align}\right\}\text{rows}

\left.\begin{align} x_0+y_1+z_2=69\\ x_2+y_1+z_0=69 \end{align}\right\}\text{diagonals}

Can anyone help me out??

• Do the numbers need to be distinct? Because otherwise, just make every value in the grid be 23. Also, is this a homework problem? – NeedAName Aug 20 '15 at 14:50
• thanx @NeedAName , but yes number must be distinct – ldev Aug 20 '15 at 14:52
• updated my answer – RE60K Aug 20 '15 at 18:55
• You dirty ... :o) – The random guy Aug 21 '15 at 11:12

The easiest way is just to take all 23's and...

subtract 5, then add back the standard 3x3 magic square.

So the solution is:

22 27 20
21 23 25
26 19 24

• Might want to add the standard magic square for reference. – Kingrames Aug 20 '15 at 15:27

This is essentially the same answer as Deusovi, but I thought I'd try to explain things a little better...

There is a well-known magic square using the numbers from $1$ to $9$:

\begin{align} &2&7& &6\\ &9&5& &1\\ &4&3& &8 \end{align}

In this square, all the rows, columns, and diagonals add up to $15 = \left(\frac{\text{max}+\text{min}}2\right)\times3$.

In your square, you want the numbers to add up to $69$. You can use the formula above to determine the $\text{max}$ and $\text{min}$ values for your square:

$69 = \left(\frac{\text{max}+\text{min}}2\right)\times3\\ \frac{69}3 = \frac{\text{max}+\text{min}}2\\ 23 = \frac{\text{max}+\text{min}}2\\ 2\times23 = \text{max}+\text{min}\\ \text{max} + \text{min} = 46$

If you want to use consecutive numbers in your square, then the difference between $\text{max}$ and $\text{min}$ needs to be $8$ (just like $9-1$). (If you don't want consecutive numbers in your square, you can count by $2$s (difference $16$), or $3$s (difference $24$), etc.)

Solving for $x+(x+8)=46$ gives $2x=38$, so $x=19$. That will be the lowest number in your square.

$19-1=18$ (lowest number in your square $-$ lowest number in standard square)

So just add $18$ to every number in the standard square, and you'll have your magic square for $69$:

\begin{align} &20&25& &24\\ &27&23& &19\\ &22&21& &26 \end{align}

Note that there are many other solutions, some of which might not use a "standard" magic square (there might not be a regular interval between each of the entries in the square).

27048 such matrices exist. I present you a few:

============
Matrix 1
21 23 25
29 22 18
19 24 26
============
Matrix 2
21 29 19
23 22 24
25 18 26
============
Matrix 3
22 23 24
29 21 19
18 25 26
============


Rest (including these) are present here.

• While these do satisfy the problem as presented in the question, the OP did clarify in the comments that the values must be distinct. – BruceDoh Aug 20 '15 at 18:36
• @BruceDoh updated – RE60K Aug 20 '15 at 18:54
• Your diagonal (bottom-left to top-right) is not 69. Your full list also use the number 0. – Kruga Nov 3 '16 at 8:48

Just put 23 at the center and let two squares at the corners of the same edge be $a$ and $b$, then calculate the others based on these two. Just make sure they're all distinct. For example:

$$\begin{array}{ccc} 15 & 44 & 10 \\ 18 & 23 & 28 \\ 36 & 2 & 31 \\ \end{array}$$