LearndleNo. 3Monday 30 November 2026
The digit that checks the others
How does a barcode scanner know it has misread a code?
This browser is not keeping data, so your progress will be lost when you close the page.
This discovery is not open yet
1 The question
The last digit says nothing about the product
Welcome back. This is where you were.
A barcode on a pack in a European shop carries 13 digits. The first twelve identify the product: a number for the company and a number for the item. The thirteenth says nothing about the product at all.
It is worked out from the other twelve, and it has one job. A scanner reads the bars through creases, smudges and glare. When it gets a digit wrong, the last digit should give it away, so the till does not ring up the wrong thing.
In about 8 minutes you will be able to
- Explain how one check digit catches every single wrong digit in a barcode.
- Say which swapped digits a barcode check cannot catch, and why.
- Judge whether another check digit rule is stronger or weaker.
2 Your guess
How good is one digit?
Welcome back. This is where you were.
One extra digit can only take ten values, 0 to 9. A wrong reading has a lot of ways to go wrong.
The scanner misreads exactly one of the 13 digits. How often does the check digit catch the mistake?
Saved. Next, you get to make the mistakes yourself.- About 1 time in 10.
- About 9 times in 10: now and then a wrong digit happens to fit.
- Every time.
Pick one in your head before you read on.
3 Try it
Try to fool the scanner
Welcome back. This is where you were.
Below is what the scanner read. Type over any digit, or use the arrow keys on it, to make it misread. The scanner multiplies the digits by 1 and 3 in turn, adds them up, and accepts the reading only if the total ends in 0.
Total 60, it ends in 0.
Accepted. This is the code on the pack.
A hint: it is not where the swap is that matters, but which two digits you swap. Look at how far apart they are. You can type new digits first, then swap them.
Which mistake slipped past the scanner?
Most swaps were rejected. Try swapping digits 7 and 8, a 1 and a 5: the total changes and the scanner says no.A swap of two digits that are 5 apart leaves the last digit of the total as it was. In this code, swapping digits 8 and 9 (a 5 and a 0) gets through. The next step shows why only those pairs.The place does not matter: every place has a weight of 1 or 3, and every pair of neighbours has one of each. What matters is the gap between the two digits.- Any swap: the scanner never notices swaps.
- A swap of two digits that are 5 apart, such as 5 and 0.
- A swap in the middle of the code.
Show the answer
A swap of two digits that are 5 apart, such as 5 and 0.
A swap of two digits that are 5 apart leaves the last digit of the total as it was. In this code, swapping digits 8 and 9 (a 5 and a 0) gets through. The next step shows why only those pairs.
Try these
- Change one digit of the reading.not done yet
- Swap two neighbouring digits that are not the same.not done yet
- Find a mistake the scanner does not notice.not done yet
4 Why
Times 3 never lands on a ten
Welcome back. This is where you were.
A wrong digit changes the total. The scanner only looks at the last digit of the total. So a mistake can only hide if it changes the total by a whole number of tens: by 10, 20, 30 and so on.
One wrong digit
A digit can be wrong by 1 to 9. At a place with weight 1, the total changes by the same amount, never a whole ten. At a place with weight 3, it changes by three times as much. Look at the last digit of each:
| Digit wrong by | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|
| Times 3 | 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 27 |
| If it were times 2 | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 |
Times 3 never gives a whole ten, so every single wrong digit shows. That is why the weight is 3. A weight of 2 would fail: a digit wrong by 5 would change the total by exactly 10, and slip through. The weight must share no factor with 10.
Two neighbours swapped
Neighbours always have one weight of 1 and one of 3. Swap a digit a and a digit b, and the total changes by twice the gap between them. That is a whole ten only when the gap is 5.
If you guessed 1 time in 10
You guessed 1 time in 10. That would be true if the check digit were random. It is not: it is chosen so that the total ends in 0, and every single wrong digit moves that total off the ten. It catches all of them.
If you guessed 9 times in 10
You guessed 9 times in 10. A close guess, and true for a random kind of mistake: two wrong digits get through about 1 time in 9. But one wrong digit never fits, because times 1 and times 3 never make a whole ten. It catches all of them.
If you guessed every time
You guessed every time. That is right, for one wrong digit. You have also seen where the check stops: some swaps, and some pairs of mistakes.
5 Use it
Three new situations
Welcome back. This is where you were.
Use what you found out. A wrong answer explains itself, and you can try again. Only your first try counts for your result.
A cashier types a barcode number by hand and gets two digits wrong. Is the mistake always caught?
It catches every single wrong digit. With two, the changes can cancel out: one digit 1 too high and another 1 too low, both at weight 1, leave the total as it was.Each mistake moves the total. If the second one moves it back to a whole ten, the reading passes. For two random mistakes that happens about 1 time in 9.Most pairs of mistakes are still caught. Only when the second one moves the total back to a whole ten does the reading pass: about 1 time in 9.- Yes: the check digit catches every wrong digit.
- No: two mistakes can cancel each other out.
- No: two mistakes are never caught.
Show the answer
No: two mistakes can cancel each other out.
Each mistake moves the total. If the second one moves it back to a whole ten, the reading passes. For two random mistakes that happens about 1 time in 9.
Someone suggests weights of 1 and 2 instead of 1 and 3. What would change?
It would catch every swap of neighbours, because a swap would change the total by just the gap, 1 to 9. But a digit wrong by 5 at a times 2 place would change the total by exactly 10, and slip through.A digit wrong by 5 at a times 2 place changes the total by exactly 10, so it slips through. In exchange, every swap would be caught: it would change the total by the gap between the digits, never a whole ten. Barcodes chose to catch every single wrong digit.The weights matter. Times 2 turns a mistake of 5 into a whole ten, so it would miss some single wrong digits. Times 3 never does.- It would be better in every way.
- It would catch every swap, but miss some single wrong digits.
- Nothing: any weights work.
Show the answer
It would catch every swap, but miss some single wrong digits.
A digit wrong by 5 at a times 2 place changes the total by exactly 10, so it slips through. In exchange, every swap would be caught: it would change the total by the gap between the digits, never a whole ten. Barcodes chose to catch every single wrong digit.
Old 10 digit book numbers (ISBN-10) use weights 10, 9, 8 and so on down to 1, and count in elevens instead of tens. They catch every single wrong digit and every swap of neighbours. Why can elevens do what tens cannot?
11 is a prime number. A mistake changes the total by a weight (1 to 10) times a gap (1 to 9), and no such product is a whole number of elevens. The price: the check digit can come out as 10, which is printed as an X.The length is not the reason. It is the counting in elevens: 11 is prime, so a weight times a gap can never make a whole eleven.Bigger alone would not help: counting in twelves would fail, because 12 shares factors with weights such as 2, 3 and 4. It works because 11 is prime.- Because 11 shares no factor with any of the weights or gaps, so no mistake adds up to a whole eleven.
- Because book numbers are shorter than barcode numbers.
- Because 11 is bigger than 10, so there is more room.
Show the answer
Because 11 shares no factor with any of the weights or gaps, so no mistake adds up to a whole eleven.
11 is a prime number. A mistake changes the total by a weight (1 to 10) times a gap (1 to 9), and no such product is a whole number of elevens. The price: the check digit can come out as 10, which is printed as an X.
6 Done
What you found out
Welcome back. This is where you were.
The check digit is picked so that a weighted total ends in 0. Times 1 and times 3 never turn a single wrong digit into a whole ten, so every single misread shows. A swap of two neighbours that are 5 apart is the one simple mistake it misses.
The same idea is used in book numbers and in the check digits of many other codes. Each one picks its rule so that the most common mistakes cannot add up to a whole multiple.
Your result
A day counts for the streak when you finish that day’s discovery on that day, by your own clock. Finishing an older one from the archive marks it done, but it does not add to the streak.
Sources, and what the models leave out
The pages below could not be opened directly while this edition was made, so each fact was checked through search results that quote them, in at least two places. The 80 of 90 swaps and the 1 in 9 for two mistakes are worked out here, not quoted. The number used on this page is the example from GS1’s own guide, not a product. Real scanners have more checks than the check digit: the bar patterns themselves follow strict rules, so many misreads are caught before the sum is ever done. This edition looks only at the check digit.
- GS1: how to calculate a check digit manuallyThe rule (weights 3 and 1, then up to the next ten) and the example number 629104150021, with check digit 3.
- GS1: the GTIN, an executive summaryThe parts of a 13 digit product number: a company prefix, an item reference and a check digit.
- Wolfram MathWorld: check digitSwapping two neighbours goes unseen exactly when they differ by 5.
- Texas A&M University: notes on check digits (Math 167)The five pairs that slip through: 0 and 5, 1 and 6, 2 and 7, 3 and 8, 4 and 9.
- Cornell University: check digitsWhy every single wrong digit is caught, and the ISBN-10 rule.
- Judson: Abstract Algebra, exercises on detecting errorsA worked example of a swap the barcode check misses.
- Wolfram MathWorld: ISBNThe ISBN-10 check: weights 10 down to 1, counting in elevens, with X for 10.
- Wikipedia: check digitThe kinds of mistakes check digits are made to catch.