Sunday Times Teaser 2919 – Letters Puzzle
by Andrew Skidmore
Published September 2 2018 (link)
My best friend has a special birthday later this month, and I have composed a Teaser to celebrate the occasion.
First of all, I wrote that date as a single number (with the day at the start, the month in the middle and the year at the end).
Then, replacing different letters consistently with different non-zero digits, I found that the sum of LETTERS and PUZZLE gives that number.
Send in your prime value for TEASER.
One Comment
Leave one →
-
Brian Gladman permalink123456789101112131415161718192021222324from itertools import permutationsfrom functools import reducefrom number_theory import is_prime# convert a sequence of digits to a numberltrs2nbr = lambda s: reduce(lambda x, y: 10 * x + y, s)# consider possible non-zero digits assigned to the eight lettersfor E, L, P, R, S, T, U, Z in permutations(range(1, 10), 8):# form LETTERS and PUZZLESletters = ltrs2nbr((L, E, T, T, E, R, S))puzzle = ltrs2nbr((P, U, Z, Z, L, E))# find the resulting date as a stringdate = str(letters + puzzle)# the date must end in 92018if date.endswith('92018') and 0 < int(date[:-5]) < 31:# now consider the remaining digits for Afor A in set(range(10)).difference([E, L, P, R, S, T, U, Z]):teaser = ltrs2nbr((T, E, A, S, E, R))# and look for a TEASER value that is primeif is_prime(teaser):print(f'TEASER = {teaser} (date = {date[:-5]}/9/2018).')