Sunday Times Teaser 3328 – Loose Change
by Andrew Skidmore
Published Sunday July 05 2026 (link)
Elaine reminded Phil to take his suit to the dry cleaners. When Phil emptied his pockets he found he had exactly £5 in coins. All denominations of coin were represented (£2, £1, 50p, 20p, 10p, 5p, 2p and 1p) but there were more of one coin than any other.
Phil told all of this to Elaine, but she couldn’t work out how many coins Phil had. “If I told you the total two-figure number of coins you would be able to work out the numbers of each coin present”, said Phil.
Which denomination appeared most and how many of that coin were present?
2 Comments
Leave one →
-
John Z. permalink1234567891011121314151617181920212223242526272829303132# coin values - 8 in all (this number is used below)coins = (1, 2, 5, 10, 20, 50, 100, 200)# split <amount> into coins (lifted from Brian's solution to 3321)def split(amount, pck=0, seq=()):if pck == len(coins):if amount == 0:yield seqelse:for np in range(amount // coins[pck] + 1):if (rem := amount - np * coins[pck]) >= 0:yield from split(rem, pck + 1, seq + (np,))# as each coin is used at least once we can start with what remainsramount = 500 - sum(coins)# dictionary indexed on total coins; values: tuple of number of each coinchange = {}for s in split(ramount):# two figure number of coins; more of one coin than any otherif 9 < (tcoins := sum(s) + 8) < 100 and s.count(max(s)) == 1:change[tcoins] = change.get(tcoins, []) + [s]for n, cs in change.items():# there must only be one way of reaching this number of coinsif len(cs) == 1:# get most used coin and number of uses - 1muc = coins[cs[0].index(nou := max(cs[0]))]print(f'Most used coin: {muc}p; used {nou + 1} times')print(*[f'{coins[i]}p: {n + 1} ' for i, n in enumerate(cs[0])])