### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,114)
- misc (2)
- project euler (2)
- puzzle (29)
- site news (43)
- tantalizer (29)
- teaser (3)

### Site Stats

- 166,224 hits

Programming Enigma Puzzles

18 July 2016

Posted by on **From New Scientist #2314, 27th October 2001** [link]

George quickly solved the popular magic square puzzle which asks you to arrange the numbers 1 to 16 in a 4 × 4 grid so that the four rows. the four columns and the two diagonals all have the same sum — so he tried to be different. He has now found an “Anti-Magic Square”, using the numbers 1 to 16, but the ten totals are all

different. They are in fact ten consecutive numbers, but in no particular sequence in relation to the square grid.One of the diagonals in George’s square contains four consecutive numbers and the other contains four prime numbers, each in ascending numerical order from top to bottom.

One row contains four numbers in ascending numerical order from left to right.

What are those four numbers?

**Enigma 8** was also about anti-magic squares.

[enigma1158]

Advertisements

%d bloggers like this:

We can suppose that the leading diagonal (NW to SE) is the ascending sequence of primes, and the reverse diagonal (NE to SW) is the ascending consecutive sequence. If we have these the wrong way round then the row we are looking for will be a descending sequence instead of an ascending sequence, so we can just look for either.

This Python 3 program runs in 577ms.

Solution:The ascending row is: 5, 9, 11, 12.There are two ways to construct the square:

The positions of 6 and 14 are interchanged in the two solutions.

In each case the third row is the ascending one, and the sums of the groups are consecutive numbers from 29 to 38.

Yes, I also got two solutions with the four numbers being 5,9,11 and 12 in the third row.

The ascending numbers are 7,8,9 and 10, and the primes are 2,3,11 and 13.