Sunday Times Teaser 2533 – A Lopsided Number
by Angela Newing
Published: 10 April 2011 (link)
In this letters-for-digits substitution puzzle, each letter consistently represents a different digit. In the display, each letter in the top row is the sum of the two letters directly below it:
_________ | P | O | S | E | R | ||||||
F | I | D | D | L | E |
What number is LOPSIDED?
One Comment
Leave one →
-
Brian Gladman permalink1234567891011121314151617181920from itertools import permutationsfrom functools import reduce# allocate digits for the bottom rowfor p in permutations(range(10), 5):F, I, D, L, E = p# compile the top rowP, O, S, e, R = q = F + I, I + D, D + D, D + L, L + E# check that the two E values are the same, that all# numbers in the top row are distinct and less than 10# and that only E is common to the two rowsif (e == E and len(set(q)) == 5 and all(x < 10 for x in q)and set(p) & set(q) == set((E,))):ls = reduce(lambda x, y: 10 * x + y, (L, O, P, S, I, D, E, D))print('LOPSIDED = {}'.format(ls))