Sunday Times Teaser 2522
by Victor Bryant
Published: 23 January 2011 (link)
I have numbered the letters of the alphabet from 1 to 26, but not in alphabetical order, giving each letter its own unique value. So, for any word, I can work out its value by adding up the values of its letters. In this way, I have found some words with equal values. For example, the following nine words all have the same value:
I SAY ALL THESE HERE HAVE EQUAL VALUES TOO.
What are the values of Y, O, U, R, S?
One Comment
Leave one →
-
Brian Gladman permalink123456789101112131415161718192021222324252627282930313233343536373839404142434445# Since all the letters have different values, the minimum# for a sum of six is 21. So we must have 21 <= I <= 26.## Since the minimum sum of 5 letters is 15, the value of any# one of letters in VALUES + 15 equals I. So the values of# all these letters lie in the range 1 <= ltr <= I - 15## A bit of elimination show that given I, A, S, E, U we can# calculate the other values using:## L = (I - A) // 2# H = L + S + U# Q = L - E - U# Y = 2.L - S# V = 2.L - E - H# R = I - 2.E - H# T = I - 2.E - H - S# O = E + (S + H) // 2from itertools import permutations# try values for I (see analysis above)for I in range(21, 27):# and values for A, E, S and U (see analysis above)for A, E, S, U in permutations(range(1, I - 14), 4):# now compute the dependent valuesL, r = divmod(I - A, 2)if r:continueH = L + S + UO, r = divmod(2 * E + S + H, 2)if r:continueQ, R = L - E - U, I - 2 * E - HT, V, Y = R - S, 2 * L - E - H, 2 * L - S# check that all values are valid and all differentt = (A, E, H, I, L, O, Q, R, S, T, U, V, Y)if all(0 < x < 27 for x in t) and len(set(t)) == 13:fs = 'Y = {}, O = {}, U = {}, R = {} and S = {}'print(fs.format(Y, O, U, R, S))