### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,383)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (56)
- site news (61)
- tantalizer (101)
- teaser (7)
- today (1)

### Site Stats

- 240,810 hits

Programming Enigma Puzzles

18 July 2012

Posted by on **From New Scientist #2874, 21st July 2012** [link]

I was teaching my nephew about arithmetic progressions – sequences like 17, 23, 29,… 677,… in which the common difference between successive terms is a constant. In this one the difference is 6 and the 111th term is 677. Later, he devised his own progression, but consistently replaced digits with capital letters, with different letters for different digits. His sequence was ONE, TWO,… THREE,… with the 111th term being THREE. The common difference was odd and more than the number represented by SIX.

Tell me the number represented by SENT?

[enigma1707]

%d bloggers like this:

The following Python program runs in 160ms.

Solution:SENT = 4236.My solution gives a unique answer, I think:

– after code

The [[

`break`

]] statement makes it stop after it finds the first solution. If you remove that it should find the other possible value for`SIX`

.Sorry to be late to the party. I do these in excel with vb so often not as pretty or succinct as python.

I found lots of solutions {where 0 is o) and another 4 when o was 1. It’s ugly code

@Paul: It’s normal in this type of puzzle to assume that numbers with leading zeros are not permitted. So in this example O, T, S would not be allowed to be zero. (I check this in my program at lines 8, 13, 28).

Assuming these restrictions you should be able to find the required solution (there are two possible values for SIX, but only one for ONE, TWO, THREE, SENT).

Here is a solution using the [[

`SubstitutedExpression()`

]] solver from theenigma.pylibrary. It executes in 176ms.Run:[ @repl.it ]