### 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

5 August 2016

Posted by on **From New Scientist #1505, 24th April 1986** [link]

“My fortune,” said the king to his vizier, “consists of a number of identical gold pieces. I remember their number by a set of peculiar numerical circumstances. I do not speak their number openly, as there are spies and eavesdroppers at court. Instead I shall tell you indirectly.”

“My fortune cannot be divided equally among my sons without splitting gold pieces. Nor could it be so divisible, unless the number of my sons were to run into thousands. My three youngest sons live in the palace, and of the other 15 some have perished in the late wars against the heathen.”

“Now the number of pieces of gold in my fortune has the following curious property: if one multiplies it by the number of my sons living, one obtained a 10-digit number in which all the digits from 0 to 9 appear, with one exception. If any number of digits be cut off the right of this number, the remaining digits form a number which is divisible without remainder by the number of digits cut off. You have a reputation of being a calculator, and so will know the number I mean, and thus the number of gold pieces in my counting house.”

The vizier bowed and reached for his pen case and parchment.

How many sons and how many gold pieces did the king possess?

[enigma356]

Advertisements

%d bloggers like this:

This Python 3 program runs in 165ms.

Solution:The king had 7 sons and 1,380,075,491 gold coins.That’s quite a lot of gold coins.

The ten digit number is 9,660,528,437 which factorises as 7 × 3253 × 424247.

This uses my number theory library that is available here