Teaser 2505: [Letter values]
From The Sunday Times, 26th September 2010 [link] [link]
I have taken 15 letters of the alphabet and given each of them a numerical value. They are not all positive, they are not all whole numbers and they are not all different. In fact, four of the letters have the same positive value.
Using these values, I can work out the total value of some words by adding up the values of their letters.
So, ONE has total value 1, TWO has total value 2, and so on up to SEVENTEEN, which has total value 17.
What is the value of NOUGHT?
This puzzle was originally published with no title.
[teaser2505]
Jim Randell 2:27 pm on 14 November 2021 Permalink |
See also: Teaser 1908, Teaser 2756, Enigma 1602, Enigma 1278, Enigma 1292.
It turns out that choosing 2 symbols to be the same, and then checking for other values with the same value as the 2 we chose is much faster than trying all combinations of 4 symbols.
The following Python program runs in 105ms.
Run: [ @replit ]
from enigma import (irange, int2words, union, matrix, subsets, trim, join, map2str, printf) # we are interested in the values of the words "one" ... "seventeen" words = dict((i, int2words(i)) for i in irange(1, 17)) # determine symbols used symbols = sorted(union(words.values())) n = len(symbols) # a function for making equations eq = matrix.equation(symbols) eqs = list(eq(w, i) for (i, w) in words.items()) # choose the first k symbols to have the same (positive) value k = 2 for ss in subsets(trim(symbols, tail=4 - k), size=k, fn=list): s0 = ss[0] eqs_ = list(eq ({s0: -1, s: 1}) for s in ss[1:]) try: vs = matrix.linear(eqs + eqs_) except ValueError: continue # check the shared value is positive, and used exactly 4 times m = dict(zip(symbols, vs)) v = m[s0] sv = sorted(s for s in symbols if m[s] == v) if not (v > 0 and len(sv) == 4 and sv[:k] == ss): continue # output solution ans = sum(m[s] for s in 'nought') printf("nought={ans} {vs} {sv}", vs=map2str(m, sep=" ", enc="[]"), sv=join(sv, sep="=", enc="[]"), )Solution: NOUGHT = 23/2 (= 11.5).
The values are:
So the four letters that share a positive value are F, R, U, V.
(E, I, S, W, also share a value, but this is zero).
We immediately see that E = 0. (As 14 = 4 + 10, 16 = 6 + 10, 17 = 7 + 10), and then I = 0 (as 13 = 3 + 10). So we could exclude these from the letters we consider when we choose some of them to be the same, to give a slight speed improvement.
This observation can also form the start of a manual solution.
LikeLike
Frits 3:33 pm on 15 November 2021 Permalink |
@Jim, symbols[:n + k – 4] makes more sense to me. fi, now you miss the situation e, v, w and x being the same.
LikeLike
Jim Randell 3:45 pm on 15 November 2021 Permalink |
@Frits: Yes it should be
[:n + k − 4].I might add a [[
trim(s, head, tail)]] function to enigma.py to make it easier to avoid these “off-by-1” errors (which are all too easy to make with Python indices).LikeLike