**From New Scientist #2304, 18th August 2001** [link]

After they had each played four rounds in the golf tournament Bernhard, Colin, Darren and Ernie all ended up with the same total score even though the scores for the 16 individual rounds that they played were all different. Each player’s score for each round was in the 60s or 70s (that is to say between 60 and 79 inclusive). Bernhard’s score in each of his four rounds was a prime number, Colin’s score in each of his four rounds was a semi-prime (the product of two prime numbers), Darren’s and Ernie’s scores in each of their four rounds were numbers that are neither prime nor semi-prime. Darren’s best (lowest) round was better than Ernie’s best round, and Darren’s worst round was better than Ernie’s worst round.

List in ascending order Ernie’s scores for the four rounds.

[enigma1148]

### Like this:

Like Loading...

This Python program runs in 38ms.

Solution:Ernie’s scores were: 64, 66, 70, 78.The full results (lowest score to highest score) are:

Each total score is 278.

By the time we reach line 46 we already know the solution to the problem (E’s score), and that there are scores for B and C (which must all be distinct from the other scores by definition).

The narrow range of maximum scores (60 – 79) makes it fairly easy to itemise

the numbers into primes, semi-primes and others, as follows:

Primes = 61, 67, 71, 73 and 79

Semi-Primes = 62 (2*31), 65 (5*13), 69 (3*23), 74 (2*37), and 77 (7*11)

Remaining numbers = 60, 63, 64, 66, 68, 70, 72, 75, 76 and 78

These sets of numbers are used in my programme

I did not find a general semi-prime constraint in MiniZinc.

Any ideas ?.

Brian Gladman has found a neat solution to the semi-prime constraint in MiniZinc, as shown in the sample test code below