### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,183)
- misc (2)
- project euler (2)
- puzzle (46)
- site news (46)
- tantalizer (49)
- teaser (3)

### Site Stats

- 184,818 hits

Advertisements

Programming Enigma Puzzles

27 July 2014

Posted by on **From New Scientist #2464, 11th September 2004**

I have in mind three numbers each of three digits (no leading zero) in each of which one digit is 3. Of the following statements about them, three are true and three are false.

(a) The number is a prime.

(b) The number is (appropriately) a cube.

(c) The middle digit is the average of the other two digits.

(d) The third digit differs from the second by 3.

(e) The number has as a factor a two-digit prime the difference of whose digits is 3, or whose sum is a cube.

(f) The number belongs (appropriately) to the set of triangular numbers 1, 3, 6, 10, 15, 21…What is the sum of the three numbers?

[enigma1306]

Advertisements

%d bloggers like this:

I think this could have been worded slightly more clearly. I took the view that for each of the three numbers being considered three of the statements were true (and three of them false), and that seemed to work.

This Python program runs in 35ms.

Solution:The sum of the three numbers is 1135.The three numbers themselves are:

It wasn’t clear to me if candidate numbers should contain exactly one digit 3. I considered numbers with multiple 3 digits in my program, and, as it turns out they could have been excluded at the start.