# An Antimagic Square

You are to place the numbers $1$, $2$, $3$, $4$ and five zeros in a $3 \times 3$ grid.

Do this in such a way so that the column, row, and two diagonal sums form the sequence $0, 1, 2, 3, 4, 5, 6, 7$ in some order.

I find such a square pleasing in a similar way as the 3x3 magic square. Unfortunately, there is not a unique solution. Kudos if you can find all solutions and prove there are no more by hand (but I don't know of an elegant way of doing that).

For any such magic square the sum of all rows, columns and diagonals:

$$\sum_{x=0}^7{x}=28$$

Now each number is counted at least twice, once for the row and once for the column.

Furthermore each number in a corner is counted one additional time for one diagonal and the number in the center is counted two additional times for both diagonals.

Now since every number gets counted at least two times we already have a sum of:

$$\sum_{x=1}^4{2x}=20$$

From this point we try to fill in the center:

4 in the center:

sum of 28:

The numbers 1, 2 and 3 must be on the edges to not increase the sum.

Not a valid solution since both diagonals have a sum of 4.

3 in the center:

sum of 26

2 must be in a corner while 1 and 4 are on the edges to get the sum perfect.

All three numbers must be opposite of a 0 otherwise we have 2 lines with the 3 in the center and a 0 on both sides of it.

By using the lines crossing the center we already get the sums: 3, 4, 5, 7.

The 2 goes to any corner.

To get a sum of 6 the 4 must be next to the 2.

The 1 must not be next to the 2 so we dont get two sums of 3.

One unique solution:

240
031
000


2 in the center:

sum of 24

2 possible solutions

4 in a corner; 1 and 3 on the edges:

Again all three numbers must be opposite of a 0 for obvious reasons.

Lines crossing the center give the sums: 2, 3, 5, 6.

The 4 goes into any corner.

To get a sum of 7 the 3 must be next to the 4.

To not get another 5 the 1 must not be next to the 4.

One unique solution:

430
021
000


1 and 3 in the corners; 4 on an edge:

Again all three numbers must be opposite of a 0 for obvious reasons.

Lines crossing the center give the sums: 2, 3, 5, 6.

4 goes onto any edge.

3 must be next to 4 to get a sum of 7.

1 must be next to 3 but not next to 4. (get one sum of 4 and don't change the 7)

One unique solution:

043
020
001


1 in the center:

sum of 22

4 and 2 must be in a corner while 3 is on an edge.

Again all three numbers must be opposite of a 0 for obvious reasons.

Lines crossing the center give the sums: 1, 3, 4, 5.

3 goes to any edge.

4 must be next to 3 to get a sum of 7.

2 must be next to 4 but not next to 3. (get 6 don't change 7)

One unique solution:

034
010
002


0 in the center:

sum of 20

1, 3 and 4 must be in the corners, while 2 is on an edge:

2 of the corner-numbers must be opposite of each other.

3 possible solutions:

1 opposite of 3:

diagonal 103 and diagonal 004 give both a sum of 4 so no valid solution

1 opposite of 4:

The diagonals give the sums 3 and 5

The 2 must not be between 3 and 4 as that would give more than 7.

The 2 must not be only next to 1 as that would give us one more line with the sum of 3.

The 2 can go either between 1 and 3 or only next to 4 which would give a sum of 6 either way.

Two unique solutions:

001
002
403

001
200
403


3 opposite of 4:

The diagonals give the sums 1 and 7.

The 2 must not go between 1 and 4 as that would give us another sum of 7.

The 2 must not go only next to 3 as that would give us the lines 023 and 104 both with a sum of 5.

The 2 can go either between 1 and 3 or only next to 4 which would give a sum of 6 either way.

Two unique solutions:

003
002
401

003
200
401


That should cover all possible cases.

The unique solutions shown are equal to 8 solutions each by mirroring and rotation.

So there are a total of 64 possible solutions to this kind of magic square.

• Of course there is a lot of case analysis, but breaking it down using the sum condition cuts it down a lot. Nice. – Tyler Seacrest Nov 16 '15 at 15:24

The unique solutions (ignoring rotations and flips) are:

0 0 1
2 0 0
4 0 3
-----
0 0 3
2 0 0
4 0 1
-----
0 0 0
0 1 3
2 0 4
-----
0 0 1
0 0 2
4 0 3
-----
0 0 0
0 2 1
4 3 0
-----
0 0 0
0 3 1
2 4 0
-----
0 0 0
0 2 4
1 0 3
-----
0 0 3
0 0 2
4 0 1
-----

Found through the method of full exhaustion.

010
320
400

c3=0,r1=1,d1=2,c2=3,r3=4,r2=5,d2=6,c1=7
This can be filpped and rotated to create more solutions...

• Nice! That's actually different than any of the ones I found ... – Tyler Seacrest Nov 16 '15 at 9:56