You’ve got this down. You’ve bagged your groceries, swiped your Nectar card, and you’ve paid with a fiver. You’re due 55p change. Surely you’ll get a 50p and 5p coin, right? Nice and light in your pocket.
Self-checkout fans will know that you really get 20p, 20p, 5p, 5p, 5p.
Last week, we advocated a new £1.23 coin in place of the new pound coin in order to reduce the number of coins you get in change. The answer to this self-service riddle is related.
Why do self-service checkouts give so much change?
Although supermarket self-checkouts accept all circulating coins, customers normally find that they only give out six possible coins as change. Normally these are
1p — 2p — 5p — 20p — £1 — £2.
They don’t give out 10p or 50p coins.
This is because self-checkout machines don’t reuse coins they are given. Instead, all the coins you put in are collected into a bucket [the brand that Sainsbury’s use call it a recycling acceptor: pdf]. The machines have separate tubes for coins as change, which are filled by staff with coins which have been checked by the bank as genuine.
The mechanisms for these tubes are expensive and prone to jamming. Combine this with the fact that many machines are based on US designs, where there are far fewer denominations of coin:
1¢ — 5¢ — 10¢ — 25¢ — $1,
you end up with machines with fewer coin tubes than types of coin.
This means that 99p in change (for example) requires nine coins with the current choice of coins to fill the machine with. But there’s a better choice of six coins. Suppose a machine has only n coin tubes to give out change. Which coins should it pick?
|Coin tubes||Coins||Number expected|
|3||1p, 20p, 50p||10.9|
|4||1p, 5p, 20p, £1||7.5|
|5||1p, 5p, 20p, 50p, £2||6.2|
|6 (self-checkout)||1p, 2p, 5p, 20p, £1, £2 (current)||5.9|
|1p, 2p, 5p, 20p, 50p, £2 (improvement)||5.4|
|7||1p, 2p, 5p, 10p, 20p, 50p, £2 or
1p, 2p, 5p, 20p, 50p, £1, £2
The message here is that £1 and 10p coins are less efficient than any other coin. The £1 coin, for example, is made up of only two 50ps, and it’s only half of £2.
So the self-checkout machines almost have it right: but if we’re going to use self-checkout machines with a small number of slots to give out change, we should swap the £1 coin tube for the 50p coin tube: then 99p is only six coins, instead of nine.
There is a good reason to keep £1 coins though: if you run out of £5 notes—a very common occurrence given that cash machines only give out £10 and £20 notes—you want to keep back your £2 coins for that. Maybe they have it right after all.
Speaking of Americans…
Are quarters better than 20-cent coins?Nearly all currencies have coin denominations starting with 1s and 5s. The differences can be found in between.
20-cent coins are favoured by most modern currencies (UK, Euro, most Commonwealth), whereas some older ones favour the 25-cent coin (US/Canada, Denmark, Thailand, pre-Euro Netherlands).
Is one more efficient than the other?
|Coins||Number expected||Weight expected|
|1p, 2p, 5p, 10p, 20p, 50p, £1, £2||4.61||32.8g|
|1p, 2p, 5p, 10p, 25p, 50p, £1, £2||4.61||33.6g|
Answer: they are equally efficient! Although, if you made a 25p coin weigh the same as a 20p coin, the expected weight is a little higher. (Fun fact: the UK used to have a 25p coin… but it was the same size/weight as the £5 coin.)
def get_min_coins(coins, target_amount): n = len(coins) min_coins =  + [sys.maxint] * target_amount for i in range(1, n + 1): for j in range(coins[i - 1], target_amount + 1): min_coins[j] = min(min_coins[j - coins[i - 1]] + 1, min_coins[j]) return min_coins
This is nice code because it avoids the lazy approach (‘greedy algorithm’) of trying the highest coin first and then dealing with the remainder. Such a lazy approach is quick but fails if you have coins of 1p, 3p, 4p and want to make 6p. The lazy approach would give you 4p, 1p, 1p; but of course the best option is 3p, 3p.
Have a play with the code yourself. Do share below if you find anything interesting.
Bonus: How does the new £1 coin square off against the old one?