The bus to Pokhara is stuck behind a landslide, and your classmate Sabina says she can read minds. “Write down any number, as long as you like, and don’t show me. Now shuffle its digits into any order, and take the smaller number from the bigger one. Circle one digit of the answer, any digit except a 0. Then read me the other digits, in any order.”
You read out 5, 7 and 8. She thinks for a second. “You circled a 7.”
She is right. She never saw your number, your shuffle or your answer. Try the trick yourself: here the page plays Sabina.
Guess before you read on. How does Sabina know the circled digit?
Pick an answer to see why.
Try it
Shuffle and subtract
Here are four tries at the trick. Look at the last column.
| Number | Shuffled | Bigger − smaller | Its digits added |
|---|---|---|---|
| 482 | 248 | 234 | 2 + 3 + 4 = 9 |
| 9,051 | 1,590 | 7,461 | 7 + 4 + 6 + 1 = 18 |
| 63 | 36 | 27 | 2 + 7 = 9 |
| 52,701 | 10,257 | 42,444 | 4 + 2 + 4 + 4 + 4 = 18 |
The sum of a number’s digits is its digit sum: the digit sum of 7,315 is 7 + 3 + 1 + 5 = 16. Sabina’s trick, and the digit-sum tests for 9 and for 3, are all about digit sums.
Remainders and digit sums
Most numbers don’t divide by 9 exactly. Divide one by 9, and something is left over: the remainder, a number from 0 to 8. Here are some numbers, their remainders, and their digit sums.
| Number | Divided by 9 | Its digit sum | The digit sum divided by 9 |
|---|---|---|---|
| 352 | 9 × 39 + 1 | 10 | 9 × 1 + 1 |
| 7,315 | 9 × 812 + 7 | 16 | 9 × 1 + 7 |
| 4,096 | 9 × 455 + 1 | 19 | 9 × 2 + 1 |
| 12,345 | 9 × 1,371 + 6 | 15 | 9 × 1 + 6 |
| 80,008 | 9 × 8,889 + 7 | 16 | 9 × 1 + 7 |
Look at the two bold columns. Then predict, without dividing: what is left over when 2,026 is divided by 9?
Pick an answer to see why.
So here is a guess: a number and its digit sum always leave the same remainder when divided by 9. If it is true, the test for 9 follows at once: a number divides by 9 exactly (remainder 0) when its digit sum does. But five rows of a table don’t prove anything. A pattern can hold for five numbers, or five thousand, and then fail (topic 16, Is a Pattern That Works Ten Times Always True?, has some that do). To be sure, we need to see why.
Why the digits know
Sharing money among nine friends
You have Rs 352, as three Rs 100 notes, five Rs 10 notes and two Rs 1 coins, and nine friends to share it among, as fairly as you can.
Take a Rs 100 note and change it into small money. Rs 99 of it shares out perfectly among nine friends, Rs 11 each, and Re 1 is left over. Each of the three Rs 100 notes leaves Re 1 over like this. Now a Rs 10 note: Rs 9 of it gives each friend Re 1, and Re 1 is left over again. Each of the five Rs 10 notes leaves Re 1. And the two coins are left over as they are.
Count what is left over: Re 1 from each Rs 100 note (3), Re 1 from each Rs 10 note (5), and the coins (2): 3 + 5 + 2 = Rs 10, the digit sum of 352. Every digit counts how many notes of its place you have, and each note leaves exactly Re 1. Then you share those Rs 10 too: each friend gets Re 1 more, and Re 1 is left. So 352 divided by 9 leaves 1, the same as its digit sum, 10.
That is the whole secret. It works for every place, however far left, because every place value is one more than a number made only of nines:
- 10 = 9 + 1
- 100 = 99 + 1
- 1,000 = 999 + 1
- 1,00,000 (a lakh) = 99,999 + 1
and every number made only of nines is a multiple of 9: 9 = 9 × 1, 99 = 9 × 11, 999 = 9 × 111, 99,999 = 9 × 11,111. So each digit, whatever its place, leaves itself over, and the leftovers of the whole number add up to its digit sum.
This is a fact about place value: the value of a digit depends on its place, ones, tens, hundreds, and each place is ten times the one to its right. It is because of place value that 352 is 3 hundreds and 5 tens and 2 ones, and each kind leaves its own leftover.
The same thing with letters
Grade 7’s algebra says it for every three-digit number at once. Call the digits a, b and c: the number is 100a + 10b + c. Split each place the way the notes were changed:
The first part is 9 times a whole number, so it shares out among nine with nothing over. What is left, a + b + c, is the digit sum. Every number is a multiple of 9 plus its digit sum. A number with more digits works the same way, with 999d for a thousands digit d, 9,999e for a ten-thousands digit, and so on. So the guess from the table is true for every number there is.
When the digit sum is itself a big number, do it again: 7,315 has digit sum 16, and 16 has digit sum 7. Keep going until one digit is left and you have the number’s digital root. It is the remainder on dividing by 9, except that a multiple of 9 has digital root 9 instead of 0.
The Grade 6 test for 3 also adds up the digits: a number divides by 3 when its digit sum does. Why does the same trick work for 3?
Pick an answer to see why.
Back to the trick
Now Sabina’s trick explains itself.
- Your number and its shuffle have the same digits, so the same digit sum, so they leave the same remainder when divided by 9.
- Take one from the other, and the two equal leftovers cancel. The answer leaves 0: it is a multiple of 9.
- A multiple of 9 has a digit sum that is a multiple of 9 too (that is the test for 9).
- So when you read out all the digits but one, Sabina adds them up, and the circled digit is whatever takes the sum up to the next multiple of 9.
For 7,315: 7,315 − 1,537 = 5,778, and 5 + 7 + 7 + 8 = 27. Circle a 7, read out 5, 7 and 8 (which make 20), and the circled digit must be 27 − 20 = 7.
Every test is the same idea
The notes gave the secret away: what matters is how much each place leaves over. For 9, every place leaves 1, so the leftovers add up to the digit sum. Ask the same question for another divisor, and you get its test. This is how the French mathematician Blaise Pascal made a divisibility test for any number, nearly four hundred years ago (the story is below).
Here is the rule, for any divisor:
- Find what each place (1, 10, 100, 1,000…) leaves over when divided by the divisor.
- Multiply each digit by what its place leaves over, and add.
- The total leaves the same remainder as the number. So the number divides exactly when the total does.
It works for the same reason as the notes: each note of a place leaves the same leftover, and the leftovers add up. Mathematicians say that remainders can be added and multiplied: to find the remainder of a sum, you can add the remainders and take the remainder of that. This arithmetic of remainders is called modular arithmetic, or clock arithmetic. Topic 6, What Day of the Week Will Your 100th Birthday Be?, uses it on the calendar.
A leftover can also be written as how far a place is short of a multiple: 10 is 1 short of 11, so for 11 we write that 10 leaves −1. The widget does this whenever the shortfall is the smaller number.
2, 5 and 10: only the last digit
10 = 2 × 5, so 10 shares out evenly among two or among five, and so do 100, 1,000 and every place to the left. Every place except the ones leaves 0. So only the ones digit counts: a number divides by 2 when its last digit is even, by 5 when it ends in 0 or 5, and by 10 when it ends in 0. That is why these tests look only at the end of the number.
4 and 8: the last two or three digits
10 doesn’t divide by 4 (it leaves 2), but 100 = 4 × 25 does, and so does every place from the hundreds to the left. So only the last two digits count: 7,316 divides by 4 because 16 does. For 8, it is 1,000 = 8 × 125 that shares out evenly, so the last three digits decide. And 6 = 2 × 3: a number divides by 6 when it passes the tests for 2 and for 3 together.
Is 51,324 divisible by 12? (12 = 3 × 4.)
Pick an answer to see why.
11: plus, minus, plus, minus
For 11, the places take turns.
The ones leave +1, the tens −1, the hundreds +1, the thousands −1, and so on. So: starting from the ones digit, add and subtract the digits in turn. If the total is a multiple of 11 (0, 11, −11, 22…), so is the number. For 4,829: 9 − 2 + 8 − 4 = 11, so 4,829 divides by 11 (it is 11 × 439). For 2,431: 1 − 3 + 4 − 2 = 0, and 0 is a multiple of 11 (11 × 0), so 2,431 divides by 11 too.
Chop off the last digit
Some books, Nepal’s Grade 6 books among them, teach a different test for 11: take the ones digit off the end and subtract it from the number that is left; repeat until you know. For 2,431: 243 − 1 = 242, then 24 − 2 = 22, a multiple of 11. Why does that work?
Call the number left after chopping x, and the chopped digit y. The number is 10x + y: 2,431 is 10 × 243 + 1. Now look at ten times the test’s number:
So ten times the test’s number differs from the real number by 11y, a multiple of 11. If the test’s number is a multiple of 11, then the real number is too. And if the test’s number leaves a remainder of 1, 2, … or 10, then ten times it leaves 10 × 1, 10 × 2, … or 10 × 10 over a multiple of 11: 10, 20, 30, 40, 50, 60, 70, 80, 90 or 100, and you can check that none of those is a multiple of 11. So then the real number isn’t either. The test is right both ways.
Seven, the awkward one
Try 7 in the widget above. Its places leave 1, 3, 2, −1, −3, −2, and then the same again: 1, 3, 2… No pattern as simple as “all 1” or “all 0 after the first”, which is why 7 is so often said to have no easy test. You can still use the leftovers. For 7,315, from the ones digit: 5 × 1 + 1 × 3 + 3 × 2 + 7 × (−1) = 5 + 3 + 6 − 7 = 7. That is a multiple of 7, so 7,315 is too (7 × 1,045).
The Grade 6 test for 7 uses the chopping trick instead: subtract twice the last digit from the rest. For 651: 65 − 2 × 1 = 63 = 7 × 9, so 651 divides by 7. It works for the same reason as the chopping test for 11:
and 21 = 3 × 7 is a multiple of 7. (And 10 × 1, 10 × 2, … 10 × 6, that is 10, 20, 30, 40, 50 and 60, are none of them multiples of 7, so the test is right both ways again.)
In 2019 a 12-year-old pupil at Westminster Under School in London, Chika Ofili, found a test for 7 of his own: add five times the last digit to the rest. For 532: 53 + 5 × 2 = 63, a multiple of 7, so 532 is one too (7 × 76).
Why does Chika’s test work? Look at ten times his number, 10 × (x + 5y).
Pick an answer to see why.
Three tests at once: 1,001
Here is a surprise in a number you might never look at twice:
1,000 is one short of 1,001, so for 7, 11 and 13 the thousands place leaves −1, the millions +1, and so on. So cut the number into groups of three digits from the right, and add and subtract the groups in turn. Try it on 287,542,178, the number Pascal used as his example: 178 − 542 + 287 = −77 = −7 × 11. So 287,542,178 divides by 7 and by 11, but not by 13, since 77 isn’t a multiple of 13.
Where the rule breaks
Does the digit sum work for 27?
999 = 27 × 37. So does the digit-sum test work for 27 too? Try 27 itself: its digit sum is 9, which isn’t a multiple of 27, yet 27 certainly is. And 1,899 has digit sum 1 + 8 + 9 + 9 = 27, but 1,899 = 27 × 70 + 9. The test fails both ways.
The leftovers say why. For 27, the places leave 1, 10, 19, 1, 10, 19… (10 ÷ 27 leaves 10 itself), not 1 every time. A digit sum works only when 10 leaves 1, and that happens only for 9 and the numbers that divide 9, which are 3 and 1. For 27 the pattern repeats every three places, because 1,000 = 999 + 1 and 999 is a multiple of 27: add the groups of three. For 1,899: 1 + 899 = 900 = 27 × 33 + 9, the same 9 left over as 1,899.
And 6?
Ram says: “A number divides by 6 when its digit sum does.” He is wrong both ways. 15 has digit sum 6, but 15 isn’t a multiple of 6; and 12 is a multiple of 6, but its digit sum, 3, isn’t. For 6, the places leave 1, 4, 4, 4… (10 = 6 + 4), not all 1.
In another base
The digit sum works for 9 because we count in tens and 9 is one less than 10. In Grade 8 you write numbers in base 5 (the quinary system), where the places are 1, 5, 25, 125 instead of 1, 10, 100, 1,000. Each of those is one more than a multiple of 4: 5 = 4 + 1, 25 = 24 + 1, 125 = 124 + 1. So in base 5 it is the test for 4 that adds up the digits. The base-5 number 1234 is 1 × 125 + 2 × 25 + 3 × 5 + 4 = 194, its digit sum is 1 + 2 + 3 + 4 = 10, and both leave 2 when divided by 4 (194 = 4 × 48 + 2).
Where this is used
Questions
What is left over when 5,000,003 is divided by 9?
Pick an answer to see why.
The four-digit number 3 _ 4 5 has one digit missing. Which digit makes it divisible by 9? Which digits make it divisible by 3?
Hint
Answer
A temple’s donation boxes hold Rs 7,23,456. Can it be shared equally among 9 committees, to the rupee? How much does each get?
Answer
Use the Grade 6 test for 7 (subtract twice the last digit) on 1,694.
Pick an answer to see why.
What is the biggest four-digit number, with four different digits, that is divisible by 9?
Hint
Answer
Rita says: “A number divides by 18 when its digit sum divides by 18.” Find a number that shows she is wrong, and give a correct test for 18.
Hint
Answer
Explain, with the place values, why you only need the last two digits to test for 4. Then say whether 7,31,316 is a multiple of 4.
Answer
Take any number, write its digits in reverse order, and subtract the smaller from the bigger. Show that the answer is always a multiple of 9. Then show that for a three-digit number it is even a multiple of 99.
Hint
Answer
Make a test for 13 in Chika’s style: chop off the last digit y, and add some number of times y to the rest, x. Which number works? Try your test on 91 and on 1,001.
Hint
Answer
Write any three-digit number twice, to make a six-digit number: 507 becomes 507,507. Explain why the result always divides by 7, by 11 and by 13.
Answer
In base 5, the number 3421 means 3 × 125 + 4 × 25 + 2 × 5 + 1. Without working out its value, what does it leave when divided by 4? Then check.
Answer
Use the Talmud’s rule (“add two for every whole century”) to find what 2,026 leaves when divided by 7, and explain why the rule works.
Answer
Where to go next
- Why Does 1089 Always Come Back? Reverse, subtract, reverse, add: a mind-reading trick like Sabina’s, with the same place-value algebra behind it.
- Is There a Biggest Prime Number? Numbers that only 1 and themselves divide, and a proof from 2,300 years ago that they never run out.
- What Day of the Week Will Your 100th Birthday Be? Remainders on dividing by 7, used on the calendar.
- Is the Answer Roughly Right? Checking sums by casting out nines, and the mistakes it can’t see.
- How Can Two Strangers Agree on a Secret in Public? (Grades 9–12) The arithmetic of remainders, keeping messages safe on the internet.
- How Does a Barcode Catch a Typing Mistake? (Computing, Going Further) Check digits built from remainders, and a program that tries every mistake.
Where these facts come from
- Nepal’s Grade 6 tests for 2, 3, 5, 7 (subtract twice the ones digit) and 11 (subtract the ones digit, repeated): CDC’s Mathematics, Grade 6, section 2.3, Divisibility test, read October 2026.
- The Talmud’s test for 7 (about the year 500), Pascal’s De numeris multiplicibus (probably before 1654) with his remainders for 7 and his example 287,542,178, Lagrange on other bases, the tables of what each place leaves for 2 to 11, and most tests being rediscoveries: Eric L. McDowell, “Divisibility Tests: A History and User’s Guide”, Convergence (MAA, May 2018), its pages “The Beginnings of Divisibility” and “Pascal Divisibility Tests”, read October 2026 (through the Internet Archive’s copy).
- Casting out nines: Greek digit “roots” (Hippolytus, Iamblichus) not used for checking, Aryabhata II’s Mahasiddhanta (around 950) as the earliest surviving use to check calculations, Ibn Sina’s “Hindu method” (about 1020), Fibonacci’s Liber Abaci: Wikipedia, “Casting out nines”, citing Datta and Singh’s History of Hindu Mathematics, read October 2026.
- Aryabhata II’s dates uncertain (Pingree: his works between 950 and 1100): Wikipedia, “Aryabhata II”, read October 2026.
- The tests for 4, 8, 11, 7 (subtract twice the last digit; add five times; the weights 1, 3, 2, −1, −3, −2) and 13: Wikipedia, “Divisibility rule”, read October 2026.
- Chika Ofili’s test for 7 (12 years old, Westminster Under School, summer holidays 2019, a holiday book whose list of tests had none for 7; the example 532): his teacher’s post “Chika’s Test” (20 September 2019, the Internet Archive’s copy), and the Transum newsletter, 1 October 2019, read October 2026.
- The Babylonian Talmud gathered between the 3rd and 6th centuries: Wikipedia, “Talmud”, read October 2026.
- The same test printed earlier, quoted from David Wells’s Dictionary of Curious and Interesting Numbers, and the reason the subtract-twice test works: Jim Loy, “Divisibility Tests” (1999, the Internet Archive’s copy), read October 2026.
- IBAN: check digits by mod 97 (ISO 7064), the first four characters moved to the end and letters as 10–35, a valid IBAN leaving remainder 1, single substitutions caught, the British example’s 28 digits, more than 60 digits at most, found piece by piece; 89 countries by December 2024, among them Qatar, Saudi Arabia and the United Arab Emirates: Wikipedia, “International Bank Account Number”, read October 2026.
- Every number in this topic computed in
checks/textbooks/math-further-6-8/04/tmp/numbers.py.
