Sunday Times Teaser 2982 – Antique Tea Pot
by Graham Smithers
Published November 17 2019 (link)
My local antiques dealer marks each item with a coded price tag in which different digits represent different letters. This enables him to tell the whole number of pounds he paid for the item. I bought a tea pot from him tagged MOE.
Inside the tea pot was a scrap of paper which I used to work out his code. The letters AMOUNT I SPENT had been rearranged to make the multiplication sum above.
How much did he pay for the tea pot?
One Comment
Leave one →
-
Brian Gladman permalink1234567891011121314151617181920212223from itertools import permutationsfrom functools import reduce# return the number given by a left to right digit sequenced2n = lambda ds: reduce(lambda x, y: 10 * x + y, ds)digits = set(range(10))# N * N == N % 10for N in (0, 1, 5, 6):# permute the remaining digits needed to form the middle# partial productfor A, I, M, S in permutations(digits.difference([N]), 4):MAN = d2n((M, A, N))if d2n((A, A, S, A)) == I * MAN:# permute the remaing digits for the rest of the multiplication sumfor E, O, P, T, U in permutations(digits.difference([A, I, M, N, S])):PIN = d2n((P, I, N))if (d2n((T, O, O, T, I, N)) == PIN * MAN and N * MAN== d2n((T, U, O, N)) and P * MAN == d2n((T, M, E, P))):print(f"The teapot cost £{d2n((M, O, E))} (A={A}, E={E}, I={I}, "f"M={M}, N={N}, O={O}, P={P}, S={S}, T={T}, U={U})")