Sunday Times Teaser 2861 – Fond Memories
by Andrew Skidmore
Published July 23 2017 (link)
One of my memories of my grandparents’ house is of an ornament consisting of three monkeys with the caption “See no evil, hear no evil, speak no evil.”
I have written down four odd numbers, one of them being the sum of the other three. Then I have consistently replaced digits with letters, using different letters for different digits. In this way the four numbers have become
SPEAK Â HEAR Â SEE Â EVIL
What number is represented by SPEAK?
2 Comments
Leave one →
-
Brian Gladman permalink123456789101112131415161718192021222324from itertools import permutations# SPEAK is the sum of the other three and the carry# into the top digit of SPEAK can only be oneS = 1# permute the remaining odd digits for the 'units' lettersfor E, K, L, R in permutations((3, 5, 7, 9), 4):# H must be a non-zero even value (all odds have been used)for H in (2, 4, 6, 8):# partially or fully evaluate the numeric value of the wordssee = 100 * S + 11 * E_h = 1000 * H + 100 * E + R_s = 10000 * S + 100 * E + K# permute the remaining digits for the remaining lettersfor A, I, P, V in permutations({0, 2, 4, 6, 8}.difference([H])):# fully evaluate the wordshear = _h + 10 * Aspeak = _s + 1000 * P + 10 * Aevil = 1000 * E + 100 * V + 10 * I + L# check that SPEAK is the sum of the other threeif speak == hear + see + evil:print(f'SPEAK = {speak} (HEAR = {hear}, SEE = {see}, EVIL = {evil})')
-
geoffrounce permalink12345678910111213141516171819202122232425262728from itertools import permutationss = 1 # must be a carrydig = set('234567890')for q in permutations ('234567890',4):p, a, k, e = qif e == '0': continueSPEAK = s * 10000 + int(p + e + a + k)if SPEAK % 2 == 0: continue# find remaining digits to permuteq2 = dig.difference(q)for Q in permutations(q2, 5):h, r, v, i, l = Qif h == '0' : continueHEAR = int(h + e + a + r)if HEAR % 2 == 0: continueEVIL = int(e + v + i + l)if EVIL % 2 == 0: continueSEE = s * 100 + int(e + e)if SEE % 2 == 0: continueif SPEAK == HEAR + SEE + EVIL:print('SPEAK = ', SPEAK)