### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,158)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 178,002 hits

Advertisements

Programming Enigma Puzzles

11 December 2011

Posted by on **From New Scientist #2806, 2nd April 2011** [link]

Fill each of the 16 boxes with a digit so that the same four consecutive digits appear in each row and in each column. In this way you can then read four 4-figure numbers across the rows and four 4-figure numbers down the columns. You must choose your digits so all eight 4-figure numbers are different and none of them has any odd factor between 2 and 20.

What are the lowest and the highest of your eight 4-figure numbers?

[enigma1640]

Advertisements

%d bloggers like this:

This program generates all possible squares and checks for ones that fit the conditions (runtime: 136ms), although if you note the simplification in the code you can get this down to 78ms.

Solution:The lowest number is 1324. The highest number is 4231.It seems the rows are 1324, 4231, 2143, 3412 in four possible orders, the columns 1423, 3214, 2341, 4132 in a corresponding order — or of course one can swap rows and columns. Twelve of the twenty-four possible permutations of the four digits have odd factors less than 21. 1234, 1432, 3142, and 4321 would be allowed but don’t occur in practice, presumably because they would inevitably cross with a forbidden number.