## Teaser 2891: Nine cut diamonds

**From The Sunday Times, 18th February 2018** [link]

An app “shuffles” and “deals” the “ace” (= 1) to “nine” of diamonds in a line, face down. Three numbers under 30 are chosen at random and each will win if it is a factor of the hidden nine-digit value. Keying # reveals the rightmost face-down card. At such a “reveal” the app displays “won”, “lost” or “in-play” for each number. The rightmost face-down cards are revealed singly until all are known.

For one deal my three numbers didn’t include a prime number and after two “reveals” were all “in-play”. After the third “reveal”, two were “won” and one “lost”.

At the third “reveal” what three-digit number was displayed?

[teaser2891]

## Jim Randell 12:22 pm

on18 September 2019 Permalink |I found the wording a bit cumbersome. Perhaps something like this would have been better:

We can eliminate some of the non-primes below 30 as possible divisors because we know the divisibility is not decided until at least digits of the number are revealed (although doing so does not make a huge difference to the run time).

For instance we can immediately discard the following divisors:

We can also discard the following divisors as the divisibility remains undecided when the final digit of the number is known:

And when the final 2 digits are revealed:

This Python program considers the three revealed digits and looks for possible divisors that would behave in the manner described. It runs in 904ms.

Run:[ @repl.it ]Solution:The final three digits of the selected number are …528.There are 166 sets of divisors that would give “in-play” (x3) when the 1st digit is revealed. This is reduced to 84 when the 2nd digit is revealed, and only one of these gives (“win”, “win”, “lose”) when the 3rd digit is revealed.

For the first digit there are 165 sets that can go with the even digits (2, 4, 6, 8) and 1 set that goes with the digit 5, although this set doesn’t survive to the 2nd digit reveal. There are 60 sets that are fixed by the reveal of the third digit, but all except the solution give (“lose”, “lose”, “lose”).

There are only two potential divisors that end up with “win” – these are 8 and 24. And only one divisor that ends up with “lose” – 22. So these are our three chosen divisors.

There are 720 candidate pandigitals ending …528. The smallest being 134679528, and the largest 976431528.

LikeLike