# No ordinary magic square

Instead of placing every number from 1-9 in the square below such that each column, row and long diagonal has the same sum, do the opposite!

Place 1-9 in the squares below in a manner such that none of the columns, rows or long diagonals have the same sum:

Edit: The question above seemed too easy for many of you. Lets take the next step. Please count or calculate the number of possible correct answers to the same question.

No ordinary magic square part 2. How many solutions are there?

• I think there must be many many solutions to this puzzle. I just put in the numbers 1-9 and swapped about 2 numbers. I think a much more interesting challenge might be to place some restrictions, or to see how many possibilities there are. I don't have the tools to do it myself, but I think that would pose a much more interesting challenge to the brilliant minds in this community. Jun 9, 2016 at 9:17
• next puzzle should be how many combinations can this be done in? Jun 9, 2016 at 9:18
• @ShaneRowattgood idea Jun 9, 2016 at 9:25
• @GregHastings You do not necessarily need to know the answer yourself. Tag it as open-ended, the right answer should be self-explanatory enough to be judged well by the community. Jun 9, 2016 at 9:37
• No. When you tag as open-ended responders know they run the risk of not having a 'correct' answer. But it is also much more challenging because there is generally no distinct 'right answer'. However someone may be able to generate a code or come up with a permutations method etc. that can calculate the number of possible solutions, and if this can be proven to be correct, then you may want to tag it as the accepted answer. See puzzling.stackexchange.com/questions/8843/… for an example, perhaps. Jun 9, 2016 at 9:41

The following is a solution

1 2 9
4 5 7
6 8 3

Reasoning

Sum of rows, then sum of columns, then diagonals.

129 = 12, 457 = 16, 683 = 17, 146 = 11, 258 = 15, 973 = 19, 153 = 9, 956 = 20

• You found a different answer than I did, but it checks out! Congratulations Jun 9, 2016 at 9:08
• If I am sure someone is right, what is the reason for making me wait a certain number of minutes to accept an answer? Jun 9, 2016 at 9:09
• @Greg Hastings I think the waiting period might be to stop spam, or perhaps to just give everyone an equal opportunity to post an answer. I'm not too sure. Jun 9, 2016 at 9:11
• Shame on the anonymous down voter. Hmmm Jun 11, 2016 at 4:08

1 2 3
4 5 6
7 8 9

Now the middle row and column both sum up to 15, so swap 6 and 8

1 2 3
4 5 8
7 6 9

Now both diagonals still sum up to 15, so swap 1 and 5.

5 2 3
4 1 8
7 6 9

Rows: 10,13,22, Columns: 16,9,20, Diagonals: 15,11

• correct. I know there are multiple solutions but have not attempted count how many. Jun 9, 2016 at 9:23

169 On the top row, 258 On the second row, 374 On the third

• Correct. I know there are multiple solutions but have not attempted calculate how many. Jun 9, 2016 at 9:23

One solution:

-------------- = 17
9 | 1 | 6 = 16
8 | 7 | 5 = 20
4 | 3 | 2 = 9
= | = | = 18
21 | 11 | 13

There are quite a few possible answers. Specifically:

There are 24960, out of a possible 362880 squares (ignoring the fact that you could consider two squares to be the same if rotated/flipped).

The first one, lexicographically sorted is

1 2 3
4 5 8
6 9 7

and the last one is

9 8 7
6 5 2
4 1 3

I arrived at the answer by writing a script in Python 3 that checks every possible option:

import itertools

matches = 0
for square in itertools.permutations(range(1, 10)):
sums = set()
# rows (sum consecutive groups of 3)
# columns (sum every third element, starting at a different position for each column)
# diagonals (summing diagonals is trickier to explain, but the following works)

# the length of a set is the number of unique elements.
# if we have 8, then each sum is unique.
if len(sums) == 8:
matches += 1

print(matches)

• I have verified this count with my own Python 2 script (before realizing it had already been posted as an answer). Jun 9, 2016 at 16:08