# Sunday Times Teaser 3028 – Rainbow Numeration

*by Stephen Hogg*

#### Published Sunday October 04 2020 (link)

Dai had seven standard dice, one in each colour of the rainbow (ROYGBIV). Throwing them simultaneously, flukily, each possible score (1 to 6) showed uppermost. Lining up the dice three ways, Dai made three different seven-digit numbers: the smallest possible, the largest possible, and the “rainbow” (ROYGBIV) value. He noticed that, comparing any two numbers, only the central digit was the same and each number had just one prime factor under 10 (different for each number).

Hiding the dice from his sister Di’s view, he told her what he’d done and noticed, but wanted her to guess the “rainbow” number digits in ROYGBIV order. Luckily guessing the red and orange dice scores correctly, she then calculated the others unambiguously.

What score was on the indigo die?

Hi John,

I have deleted your earlier version as you requested. I have also taken the liberty of reformatting lines 76..80 as this suggests to me that there are bugs in line 80.

There is always a balance that has to be struck between the amount of manual analysis and the amount of code used in any teaser solution. I think your preliminary analysis is neat but I can’t help wondering whether on this occasion the effort to exploit this in your code has made an already long program significantly longer than it really needs to be! The use of a subroutine to convert digits sequences into numbers would make sense since you do this several times in your code.