### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 166,224 hits

Programming Enigma Puzzles

21 August 2013

Posted by on **From New Scientist #2931, 24th August 2013** [link]

Eve said to me that she had in mind an even three-figure number that was divisible by 3. She also told me that she had spelled out the number in words and that she had counted the number of letters used. Knowing the number of letters would enable me to work out her number, she said.

Oddy said to me that he had in mind an odd three-figure number divisible by 3. He told me that he, too, had written the number in words and that he had counted the number of letters used. He said that knowing the number of letters would again enable me to work out his number.

Then the two of them had a little chat and announced that their numbers had no digit in common.

What were their numbers?

[enigma1763]

Advertisements

%d bloggers like this:

A straightforward approach in Python (using the

int2words()function from theenigma.pylibrary originally written forEnigma 1614) give the answer in a reasonable time. This code runs in 35ms.Solution:Eve’s number was 378. Oddy’s number was 201.Mine is pretty similar in principle:

but it uses my own ‘number_as_words’ routine: