### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,367)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (48)
- site news (58)
- tantalizer (94)
- teaser (7)

### Site Stats

- 233,130 hits

Programming Enigma Puzzles

11 July 2012

Posted by on **From New Scientist #2873, 14th July 2012** [link]

In 1951 the Festival of Britain was held, with three main features at the exhibition site – the Dome of Discovery, the Skylon and the Royal Festival Hall. This inspired me to write down three positive whole numbers; altogether they use nine digits, with no digit repeated. One of the numbers is a perfect square and the other two are primes. They add up to 1951.

What, in increasing order, are my three numbers?

[enigma1706]

%d bloggers like this:

The following Python program uses the prime sieve from the

enigma.pylibrary. It runs in 45ms.Solution:The three numbers are 487, 503 and 961.Here is my effort:

Greetings Brian,

You have done good and understandable work.

Your program gives the triples numbers for the sums 1951, 1453, 1881 correctly when I try it for each.

How can one modified your program to output the triple numbers for any sum, if possible,

for the same enigma (two primes, one perfect number, 9 different digits, no same digit).

The best way to do this depends on how big the sum can be. If it has to be up to 9 digits, my simple prime sieve would have to be changed to give much larger primes. Apart from this the various fixed limits would need to be set from the sum value (the limits are hard coded right now). This would be easy if the maximum sum allowed was not too large.