post

Why self-service machines give such awful change

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.

Wrong!

Self-checkout fans will know that you really get 20p, 20p, 5p, 5p, 5p.

Why?!

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
2 1p, 20p 21.5
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
5.0

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?

20-cent and 25-cent coins

Euro 20c vs Canadian 25¢. Fight!

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.)

Programming this yourself

As with the £1.23 post, I am doing this all with a bit of Python code I found on StackExchange:

def get_min_coins(coins, target_amount):
    n = len(coins)
    min_coins = [0] + [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?

post

Forget a new £1 coin, we need a £1.23 coin

Tomorrow, the Royal Mint—producer of British coins—is introducing a new, thinner, dodecagonal £1 coin. But they’re missing a trick. To cut the amount of change in our pockets, we don’t need a lighter £1 coin: we should replace it with a £1.23 coin.

New one pound coin

Coming soon to your pocket… the new pound coin. (Royal Mint)

The question you need to ask is: When you pay for something in a shop with a banknote, how many coins do you expect to get back in change? How much heavier will they make your purse?

The answers are different for different countries, so we’ve worked it out for your country as well!

How many coins do you expect to receive in change?

The smallest banknote in the UK is the meaty see-through £5 note. So if you pay with a note, you would hope to receive somewhere between 1p and £4.99 in coin change back. Supposing an even distribution of prices and that cashiers always give you the most efficient change (next week’s blog: when self-service machines don’t give efficent change), on average, then, how many coins do you expect to receive?

We’ve done the calculation for a few countries, for change amounts up to the smallest banknote.
You can find the code we’ve used at the bottom of the page.
Average number of coins expected as change in each country
Some variants on the UK system are highlighted in pink. Switching the £1 coin for a £1.23 coin reduces the coin expectancy by about half a coin, from 4.61 to 4.07: the best-performing option.

Some other observations:

  • Some countries do really well (India) because banknotes are used almost exclusively.
  • Low-scoring countries have abolished their smallest denominations (pennies etc.)
  • The US only has 4 common coins, yet averages the same number of coins as the UK with 8.
  • The pre-decimal UK system (pounds, shillings and pence) performs almost as efficiently as the current UK system.
  • The Harry Potter system (29 knuts in a sickle, 17 sickles in a galleon) is ridiculous.

And what about the weight of these expected coins in our pockets?

Average weight of coins expected as change in each country
Observations:

  • The UK has, on average, the heaviest coins out of the top 20 circulating world currencies. Removing 1p and 2p would reduce the weight by 20%.
  • Despite expecting the same number of coins in the UK and US, the weight of US coins is about half that of the UK.
  • Australian coins are heavy because their sizes are the same as pre-decimal UK ones.

If we could add just one coin, what would it be?

Suppose we were to keep all our coins, but could add one more. Which denomination would reduce the average number of coins you receive in change the most?
Average number of coins expected as change  if you add a new coin of a certain value
Adding a £1.33 or £1.37 coin would reduce the average number of coins from 4.61 to 3.93.

If you could choose any coins, what would they be?

So suppose we start over. A whole new set of coins up to £5. Designed to be the most efficient in terms of change. For a set number of coins, what would they be?

Number Coins Number expected
2 1p, 22p or 1p, 23p 21.3
3 1p, 14p, 61p 9.98
4 1p, 7p, 57p, 80p 6.82
5 1p, 6p, 20p, 85p, £1.21 5.45

Programming this yourself

I do this all with a bit of Python code I found on StackExchange:

def get_min_coins(coins, target_amount):
    n = len(coins)
    min_coins = [0] + [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.

Questions to investigate

Next week we’ll use this code to answer the age-old question of

  • Why do supermarket self-checkout machines give such terrible change?

Plus, we’ll ask are quarters are better than 20-cent pieces?

Have a play with the code yourself. Comments are open below when you find something interesting.

Bonus: old £1 coin v new £1 coin

post

Review: Mathematical socks

This Christmas, I received mathematical socks. A great gift, you might think. But is it good maths or fake maths? Can you wear them and be taken mathematically seriously? Thus I have undertaken this important review.

Unboxing

The socks come beautifully packaged and folded, tied together with a fancy red label, which gives a nifty standing suggestion.

Beautifully packed mathematical socks

Beautifully packed mathematical socks


Unboxing grade: A

Mathematical content

There are five distinct mathematical items on the socks. I have graded them individually. The younger reader may wish to refer to this helpful guide to converting to new grades.

1. Proof of Pythagoras

Sock v Elements

Pythagoras’ Theorem proved on a sock (left) and in the Elements (right)

Continue reading

post

Switching sides in a matrix equation

Suppose you’ve got a simple matrix equation, $\boldsymbol{y} = \boldsymbol{\mathsf{A}x}$. Now switch some elements of $\boldsymbol{y}$ with some elements of $\boldsymbol{x}$. How does the matrix change? 

This problem seems like it should be neat: if we switch all the elements of $\boldsymbol{y}$ with all the elements of $\boldsymbol{x}$, then our new matrix is just $\boldsymbol{\mathsf{A}}^{-1}$. Since we have a full description of how the elements of $\boldsymbol{y}$ depend on $\boldsymbol{x}$ (and vice versa), switching only some elements should involve some sort of neat part-inverse of $\boldsymbol{\mathsf{A}}$. But I’m yet to find a neater description of the new matrix than what I’ve worked out below. Surely linear algebra has a method for this? Comment below if you can beat this.

Let me be more clear with the problem by using an example. Consider the matrix equation $$\begin{pmatrix}y_1 \\ y_2 \\ y_3 \\ y_4\end{pmatrix} =
\boldsymbol{\mathsf{A}}
\begin{pmatrix}x_1 \\ x_2 \\ x_3 \\ x_4 \end{pmatrix}.$$Now if I switch $y_3$ and $x_3$,$$\begin{pmatrix}y_1 \\ y_2 \\ x_3 \\ y_4\end{pmatrix} =
\widetilde{\boldsymbol{\mathsf{A}}}
\begin{pmatrix}x_1 \\ x_2 \\ y_3 \\ x_4 \end{pmatrix},$$what is the new matrix $\widetilde{\boldsymbol{\mathsf{A}}}$ in terms of $\boldsymbol{\mathsf{A}}$? Continue reading

post

Stopping distances in the Highway Code are wrong

To pass your driving theory test in the UK, you need to know how far it will take you to stop if you brakes at a particular speed. But the numbers given in the Highway Code are based on inaccurate calculations that exist only because they formed an easy formula for stopping distances when we thought in feet instead of metres. Simple mechanics shows that the Highway Code systematically underestimates how long it takes to stop. At the end we propose an easy, safer equation for stopping distances.

The stopping distances you need to learn for your driving theory test are given in the Highway Code as:

Speed Stopping distance
20mph 6 + 6 = 12m
30mph 9 + 14 = 23m
40mph 12 + 24 = 36m
Speed Stopping distance
50mph 15 + 38 = 53m
60mph 18 + 55 = 73m
70mph 21 + 75 = 96m

Your stopping distance is given by thinking distance + braking distance. These numbers disguise a fascinating fact that you can only see if you write the stopping distances in feet:
Braking distances in feet Continue reading

post

Names for large numbers

What’s bigger than a trillion? Bigger than a quadrillion? Can we give names for large numbers which are snappier than $2^{74,207,281}−1$? As we have found the need to use large numbers in our lives, various interesting systems have been proposed. Impress your friends with some of these!

Extending million, billion, trillion…

An extension to ‘million, billion, trillion’ was proposed in John Conway and Richard Guy’s book, The Book of Numbers (not to be confused with the slightly older book sharing its name).

With the English language finally having settled on the traditionally American designation that 1 billion = 1 thousand million (thanks finance!), Conway & Guy extended the system that already exists up to $10^{30}$. They take the number $n$ occurring in $10^{3n+3}$:

$10^6$ million $n=1$   $10^{21}$ sextillion $n=6$
$10^9$ billion $n=2$   $10^{24}$ septillion $n=7$
$10^{12}$ trillion $n=3$   $10^{27}$ octillion $n=8$
$10^{15}$ quadrillion $n=4$   $10^{30}$ nonillion $n=9$
$10^{18}$ quintillion $n=5$   $10^{33}$ decillion $n=10$

and use its Latin translation as a prefix for $n \geq 10$. So we get

  • $n = 11$: undecillion
  • $n = 18$: octodecillion
  • $n = 25$: quinvigintillion

Continue reading

post

Fun with water bells

Catch a spoon under the tap when washing up and everyone knows you’ll end up with water everywhere. What you might not know is what shape the water is trying to form. And what you probably won’t know is that if you let the water form this shape, it might end up connecting back into a closed 3D shape. Welcome to the exciting world of water bells.

DIY water bell

Take a 10p coin and blu-tack it to the top of a pen. Take your contraption to the kitchen sink and turn it on a medium speed. Now hold the pen quite far down and put the pen under the stream, so that the water hits the coin flat. With very little adjusting of the position of the pen and speed of the water, you should be able to get the water to not just spread out, but to come back to form a water bell (see picture at the top).

Some things you might like to try:

  • How big/small you can make the water bell?
  • What if you use a non-circular coin at the top?
  • What if you tilt the coin?

Continue reading

post

New largest prime number discovered!

Here at Chalkdust we’re very excited by the latest discovery of the new largest prime number, which is the Mersenne prime $2^{74,207,281}-1$. So to celebrate this discovery by the Great Internet Mersenne Prime Search, we thought we’d publish the number.

7 floppy disksFun facts first:

  • All Mersenne primes are of the form $2^p – 1$, where $p$ is prime (the first four are 3, 7, 31, and 127).
  • Mersenne primes are named after Marin Mersenne (whose face is in the banner at the top!).
  • In binary, the number is ‘1’ repeated 74,207,280 times!
  • This means it requires 8.85MB of disk space to store, or 7 floppy disks!
  • Using the “million, billion, trillion” naming system, you could call this number 300 septillisensquadragintaquadringentiilliquattuorducentillion!

Continue reading