Sunday Times Teaser 2915 – £sd
by Graham Smithers
Published August 5 2018 (link)
50 years ago, the coins in circulation were the halfpenny (1/2d), penny (1d), threepenny bit (3d), sixpence (6d), shilling (12d), florin (2 shillings) and half crown (2 shillings and sixpence).
One day, having at least one of each of the above coins, I decided to bank them.
The cashier set out the coins in separate piles, checked them (discovering that the number of coins in each pile was a square), and gave me exactly a 10-shilling note in exchange.
If I told you how many different numbers of coins were in those piles, you should be able to work out the numbers of each coin.
One Comment
Leave one →
-
Brian Gladman permalink12345678910111213141516171819202122232425262728from number_theory import frobenius_solvefrom collections import defaultdict# squares up to 225sq_set = {n * n for n in range(16)}# denominations for pre-decimal era coinsdn = '1/2d 1d 3d 6d 1s 2s 2s6d'.split()# coin values in half penny unitscoins = (1, 2, 6, 12, 24, 48, 60)# for solutions indexed on the number of different numbers of each coinn2c = defaultdict(list)# find combinations of coins that add up to 10 shillingsfor s in frobenius_solve(coins, 240):# the must be at least one of all denominationsif min(s) > 0:# all numbers of coins must be squareif all(n in sq_set for n in s):n2c[len(set(s))].append(s)# find a solution that is unique for the number of# different numbers of coinsfor k, ls in n2c.items():if len(ls) == 1:print(', '.join(str(n) + ' x ' + d for n, d in zip(ls[0], dn)))