### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,393)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (61)
- site news (62)
- tantalizer (105)
- teaser (7)
- today (1)

### Site Stats

- 244,211 hits

Programming Enigma Puzzles

18 January 2019

Posted by on **From New Scientist #2183, 24th April 1999** [link]

Harry, Tom and I were asked by Mary each to select a five-digit perfect cube that consisted of five different digits and to tell her (in secret) which one had been selected. After we had each done so she said:

“If I now told any one of you individually how many digits his cube has in common with each of the other two cubes he could deduce with certainty one, but not both of them”.

That in itself was enough information to enable me to deduce with certainty both the cubes that Harry and Tom hadÂ between them selected.

What were those two cubes?

In the magazine this puzzle was published asÂ **Enigma 1026** (despite that number having been used the previous week).

[enigma1027]

%d bloggers like this:

This Python program runs in 80ms.

Run:[ @repl.it ]Solution:Harry and Tom have selected 19683 (= 27³) and 68921 (= 41³).There are only two sets of numbers which allow Mary to make her statement:

Note that the middle cubes, 42875 and 54872, have the same digit content, so we’ll only look at case A:

The person with 19683 would be told: “1 and 4”. From the “4” they can deduce that one of the other cubes is 68921, but the “1” is ambiguous between 42875 and 54872.

The person with 42875 would be told: “1 and 2”. From the “1” they can deduce that one of the other cubes is 19683, but the “2” is ambiguous between 10648 and 68921.

The person with 68921 would be told: “2 and 4”. From the “4” they can deduce that one of the other cubes is 19683, but the “2” is ambiguous between 42875 and 54872.

Case B is similar with 42875 and 54872 swapped.

But then when Mary makes her statement, the three participants know that these are are only two possible sets of numbers.

So, the person with the middle number would know for sure what the other two numbers were, whereas the other two would not be sure which of the middle numbers had been chosen.

But this means by making her statement Mary invalidates it, because after she’s made it Dick can deduce with certainty both the other two numbers with no further information, and everyone can deduce the numbers of shared digits without being told.