### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 168,282 hits

Programming Enigma Puzzles

11 September 2012

Posted by on **From New Scientist #2681, 8th November 2008** [link]

Our toddler granddaughter has been staying with us, and she has used our standard set of dominoes (each twice as long as broad) for building castles. Now that she has gone home I have managed to find most of the set, and I can divide these into two unequal lots. Each lot can be arranged into a solid square, and can also be arranged into a closed ring (for example, 6-4#4-2#2-2#2-6). The total number of “pips” in each lot sum to a perfect square.

Which dominoes are still lost?

[enigma1519]

Advertisements

%d bloggers like this:

The following Python program runs in 6.4s (under PyPy).

As noted in the comments in the code, in the initial stages of the computation it can be deduced analytically what the solution to the puzzle is. But we want to see a constructive solution, so the program goes on to generate all possible sets of dominoes that satisfy the conditions of the puzzle, and verify that they all correspond to the solution.

My original Perl code ran in 2m6s.

Solution:The lost dominoes are 0-0 (double blank) and 2-2 (double two).