### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,314)
- misc (3)
- project euler (2)
- puzzle (78)
- puzzle# (21)
- site news (54)
- tantalizer (80)
- teaser (7)

### Site Stats

- 217,165 hits

Programming Enigma Puzzles

13 April 2019

Posted by on **From New Scientist #2171, 30th January 1999** [link]

In my local pub there is an electronic “slot machine” which offers a choice of various games. In one of them, called

Primetime, after inserting your pound coin the 9 digits 1-9 appear in random order around a circle. Then an arrow spins and stops between two of the digits. You win the jackpot if the two-digit number formed clockwise by the two digits on either side of the arrow has a two-figure prime factor. So, if the digits and arrow ended up as above, you would win the jackpot because 23 is a factor of 92.However, with the digits in the same position but with the arrow between 8 and 1 you wound not win.

I recently played the game. The digits appeared and the arrow started to spin. But I realised to my annoyance that, no matter where the arrow stopped, I could not with the jackpot.

Starting with 1, what is the clockwise order of the digits?

[enigma1015]

%d bloggers like this:

This Python 3 program finds the answer recursively in 97ms.

Run:[ @repl.it ]Solution:The digits are: 1, 6, 3, 2, 7, 5, 4, 9, 8.Giving the 2-digit numbers: 16, 63, 32, 27, 75, 54, 49, 98, 81.

That is the only order out of 8! = 40320 in which no prime factor greater than 7 occurs.

Factor 11 is not possible, because there can be no double digits.

I think I’m right in saying that in 72 games one could expect to win (on average) with factor 13 seven times, 17 and 19 five times each, 23 four times, 29 and 31 three times each, 37, 41, 43, and 47 twice each, and each higher prime up to 97 once. That is an overall probability 5/8 = 0.625 of winning.