### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 166,357 hits

Programming Enigma Puzzles

28 September 2015

Posted by on **From New Scientist #2356, 17th August 2002** [link]

Harry, Tom and I were trying to find a five-digit number consisting of five different digits that when we multiplied it by 9 we created another five-digit number consisting of the other five digits.

We each found a different number of this type, but the numbers that Harry and Tom found each used the same five digits.

Which five-digit number did I find? (Remember that the answer required is the number as it was before multiplication).

See also **Enigma 1317**.

[enigma1200]

Advertisements

%d bloggers like this:

This Python code runs in 117ms.

Solution:You found 10647.There are only three numbers with the required property. Harry and Tom found the other two:

A bit of analysis gives a very short program to find the three candidate numbers. This Python program runs in 35ms.

A MiniZinc solution gave the same three numbers :

It it easy to show that both 5-digit numbers have to be multiples of 9, so the for loop can be

for a in irange(10242,10876,9):Good point. Every little helps. Only 24 of the remaining candidates for

ahave no repeated digits and don’t include the digit 9, so this gives a way to achieve a manual solution.