Sunday Times Teaser 2898 – My Valentine
by Graham Smithers
Published April 8 2018 (link)
Using only positive digits, MILLY wrote down a two-digit number and a nine-digit number, both numbers being divisible by 14.
Splitting her nine-digit number into three three-digit numbers, she noticed that all three numbers were also divisible by 14.
Systematically replacing different digits by different letters, her two-digit number and nine-digit number ended up as MY VALENTINE.
What number is represented by MILLY?
2 Comments
Leave one →
-
geoffrounce permalink12345678910from itertools import permutationsfor my in (14, 28, 42, 56, 84, 98):m, y = divmod(my, 10)# check three three-digit numbers for divisibility by 14for v, a, l, e, n, t, i in permutations(set('123456789').difference(str(my))):if not any(int(x) % 14 for x in (v + a + l, e + n + t, i + n + e)):print(f'MILLY = {10000 * m + 1000 * int(i) + 110 * int(l) + y}')