New Scientist Enigma 936 – Shift of Fortune
by Susan Denham
From Issue #2091, 19th July 1997 (link)
To enter the lottery I chose six lucky numbers: I called this “selection A”. I have added 1 to each of those six numbers to form a new “selection B”, I’ve added 1 again to each to form “selection C”, and repeated this twice more to form “selection D” and “selection E”. So, for example, the lowest number in selection E is four more than the lowest number in selection A. Of course, as always, each selection is in the range 1-49.
In one of the selections (but not selection A) the six numbers are all two-digit numbers with the same first digit.
In one of the selections (but not selection A) there are no prime numbers.
Each week I decide to have two goes at the lottery and I choose at random two of my five selections. I know that whichever pair I choose, it would be possible for one of the selections to contain four of the six winning numbers and the other selection to contain none. On the other hand, whichever pair I choose, it would also be possible for both selections to contain four of the six winning numbers.
Which six numbers form “selection A”?
You assume that the selection with the same first digits is different from the one without prime numbers. This is not explicitly stated.
I do, but the code is fine without this assumption (leave 0 in on line 15).