**From New Scientist #2822, 23rd July 2011** [link]

I have written down five single-digit positive integers.

The sum of the five integers is divisible by the fifth integer, but not by any of the first four. The sum of the first four integers is divisible by the fourth but not by any of the first three. The sum of the first three integers is divisible by the third but not by either of the first two. The sum of the first two integers is divisible by the second but not by the first.

List the five integers in the order in which I have written them down.

[enigma1656]

### Like this:

Like Loading...

The following recursive Python program runs in 35ms.

Run:[ @codepad.org | @repl.it ]Solution:The five integers are 8, 4, 6, 3 and 1.You can run this program by visiting [ http://enigmaticcode.codepad.org/LnBN3Bbo ].

I just realised that the [[

`alldifferent()`

]] constraint is not required by the puzzle text, and you still get the right answer if you remove this constraint from the model.Yes, I have just confirmed the ‘AllDifferent’ condition is not required in my Visual Basic solution which runs in VS 2015. The ‘AllDifferent’ condition is commented out in this posting.

Both options had fast run times :

1. With AllDifferent condition :

5 Digits are: 8,4,6,3,1

1.6535 msec

2. Without AllDifferent condition :

5 Digits are: 8,4,6,3,1

1.0989 msec