Sunday Times Teaser 3163 – Letterboxes
by Victor Bryant
Published Sunday May 07 2023 (link)
To enable me to spell out ONE, TWO, up to NINE one or more times, I bought large quantities of the letters E, F, G, H, I, N etc. Then in a box labelled “ONE” I put equal numbers of Os, Ns and Es; in a second box labelled “TWO” I put equal numbers of Ts, Ws and Os; in box “THREE” I put equal numbers of Ts, Hs and Rs, together with double that number of Es; etc. In this way I made nine boxes from which my grandson could take out complete sets to spell out the relevant digit. In total there was a prime number of each of the letters, with equal numbers of Ns and Vs, but more Ts. Furthermore, the grand total number of letters in the boxes was a two-figure prime.
In the order ONE to NINE, how many sets were in each box?
# why is this necessary?
–> if you remove the n6 loop it will work fine. n6 is already set at the value of X.
Thanks Frits, I looked at this code for literally hours last night without seeing this!
Without making the assumption that there are no more than 9 sets of letters in any box we can use the following.
Variable maxnum can even be determined to a lower value considering we have already a prime number of sets of letters in four boxes .
Jim Randell has produced a neat solution to this teaser here. Here is my version of Jim’s code: