# Thread: Challenging Number placement puzzle

1. ## Challenging Number placement puzzle

Imagine you have a 5 x 5 grid. You have to place the numbers 1-25 on the grid so that each row, column and diagonal add up the the same number, can it be done?

For example, here's what I mean with a 3x3 version.

4 9 2
3 5 7
8 1 6

All columns, rows and diagonals all add up to 15.

I would love someone to work this out, been annoying me for ages.

2. Originally Posted by craig
Imagine you have a 5 x 5 grid. You have to place the numbers 1-25 on the grid so that each row, column and diagonal add up the the same number, can it be done?

For example, here's what I mean with a 3x3 version.

4 9 2
3 5 7
8 1 6

All columns, rows and diagonals all add up to 15.

I would love someone to work this out, been annoying me for ages.
If you have Matlab, just type:
Code:
magic(5)
I think that's what you're looking for.

3. Originally Posted by janvdl
If you have Matlab, just type:
Code:
magic(5)
I think that's what you're looking for.
Do you have the corresponding Maple command by any chance ?

4. Originally Posted by craig
Do you have the corresponding Maple command by any chance ?
I'm afraid not (I've only done a Matlab course), but just give me a moment, I'm installing Matlab now, then I'll just post the matrix here for you.

5. Originally Posted by janvdl
I'm afraid not (I've only done a Matlab course), but just give me a moment, I'm installing Matlab now, then I'll just post the matrix here for you.
Thankyou! Someone gave me this problem & I've been stumped ever since

6. I'm sorry, the bloody thing refuses to activate my LEGAL copy... I'll get back to you on this one in the next hour.

7. Originally Posted by janvdl
I'm sorry, the bloody thing refuses to activate my LEGAL copy... I'll get back to you on this one in the next hour.
Just found some on the internet.

19 8 22 11 5
12 1 20 9 23
12 24 13 2 16
3 17 6 25 14
21 15 4 18 7

Thanks for the help anyway

8. Originally Posted by craig
Just found some on the internet.

19 8 22 11 5
12 1 20 9 23
12 24 13 2 16
3 17 6 25 14
21 15 4 18 7

Thanks for the help anyway

9. There are hundreds of 5-by-5 Magic Squares
and there are formulas for generating them.

Here's one of them:

. . $\begin{array}{ccccc}17 & 24 & 1 & 8 & 15 \\ 23 & 5 & 7 & 14 & 16 \\ 4 & 6 & 13 & 20 & 22 \\ 10 & 12 & 19 & 21 & 3 \\ 11 & 18 & 25 & 2 & 9 \end{array}$

10. Originally Posted by janvdl
No worries, I didn't actually know what they were called until you said so thank for that

11. ## Response

My first step is to write out the numbers from 1 to 25 from left to right.

The second step is to flip the diagonals around the center number (which is 13).

The third step is to switch numbers to balance out the rows and columns in the 5 x 5 magic square (where all the rows, columns and diagonals sum to 65 in a normal 5 x 5 magic square).

Here's why it's so hard to work out. There are 275,305,224 distinct normal 5 x 5 magic squares. If it takes just a second to make one of them, how long would it take someone to make all of them? (for that matter, how many methods would one need to make all of them?)