In school you memorised a collection of divisibility rules that felt like magic spells:
- Divisible by 3? Add the digits. If the sum is divisible by 3, so is the number.
- Divisible by 9? Same — add the digits, check divisibility by 9.
- Divisible by 11? Alternating sum of the digits. If it is divisible by 11, so is the number.
- Divisible by 4? Look at the last two digits.
- Divisible by 8? Last three digits.
- Divisible by 5 or 10? Last digit.
These are not disconnected tricks. They are all consequences of one fact in modular arithmetic: each rule reflects what powers of 10 look like modulo the divisor in question. Once you see this, you stop memorising individual rules and start deriving the right rule for any divisor on demand.
The one fact that generates everything
Every positive integer, when written in decimal, is a sum:
where a_i are the decimal digits. Modding by any m turns this into
The whole game is computing 10^i \bmod m for each i. Let's do it for the classic divisors.
Mod 3 and mod 9: powers of 10 collapse to 1
10 \equiv 1 \pmod 3, so 10^i \equiv 1^i = 1 \pmod 3 for every i. Plugging into the formula:
The digit sum is congruent to N modulo 3. So N is divisible by 3 iff its digit sum is. Exactly the same argument gives the rule for 9, because 10 \equiv 1 \pmod 9 too.
Why: the powers of 10 all reduce to the same residue, so the place values don't matter — only the digits do. That is exactly what "add the digits" captures.
Mod 11: powers of 10 alternate between 1 and -1
10 \equiv -1 \pmod{11}, so 10^i \equiv (-1)^i \pmod{11}: alternating 1, -1, 1, -1, \ldots
Plugging in:
The alternating digit sum is congruent to N modulo 11. That's the alternating-sum rule exactly.
Mod 4 and mod 8: high powers of 10 vanish
10^2 = 100 = 25 \cdot 4, so 10^i \equiv 0 \pmod 4 for i \geq 2. The formula collapses:
Only the last two digits matter. Same logic for 8: since 10^3 = 1000 = 125 \cdot 8, powers \geq 3 vanish, so only the last three digits matter.
Mod 5 and mod 10: even simpler
10 \equiv 0 \pmod 5, so every positive power of 10 vanishes mod 5, leaving just a_0. The last digit determines divisibility by 5. Same for 10, trivially.
The master pattern
Every divisibility rule is answering the same question: what do powers of 10 look like mod m? And the shape of those powers determines the shape of the rule.
| Divisor m | 10^i \bmod m | Resulting rule |
|---|---|---|
| 2 | 0 for i \geq 1 | Last digit |
| 3 | 1 always | Digit sum |
| 4 | 0 for i \geq 2 | Last two digits |
| 5 | 0 for i \geq 1 | Last digit |
| 8 | 0 for i \geq 3 | Last three digits |
| 9 | 1 always | Digit sum |
| 10 | 0 for i \geq 1 | Last digit |
| 11 | (-1)^i | Alternating digit sum |
| 7 | Cycles 1, 3, 2, 6, 4, 5, \ldots | No clean rule (cycle too long) |
Notice 7 in the last row. Its rule is messy — you would multiply each digit by the appropriate entry of the cycle 1, 3, 2, 6, 4, 5, 1, 3, \ldots and sum. That is why no one memorises "the rule for 7": there is no clean pattern to remember, because the powers of 10 mod 7 form a genuinely random-looking length-6 cycle.
Interactive: see the powers of 10 dictate the rule
Using, then proving
The two-step reflex to build:
- Use the rule. When a problem needs you to test divisibility by 3, 9, or 11, apply the digit-based shortcut immediately. No wasted computation.
- Remember why. When a proof asks "show N is divisible by …," you often need to convert the digit-based statement back into a congruence. The rule is the shortcut; the congruence is the reason.
Problem. Show that every integer of the form \overline{abcabc} (a 6-digit number with repeating 3-digit block) is divisible by 7, 11, and 13.
Using divisibility rules: You can notice that \overline{abcabc} = \overline{abc} \cdot 1001. And 1001 = 7 \cdot 11 \cdot 13. So \overline{abcabc} is 1001 \cdot k, which is divisible by 7, 11, and 13.
Proving it with modular arithmetic: In symbols, \overline{abcabc} = 1000 \cdot \overline{abc} + \overline{abc} = 1001 \cdot \overline{abc}. Since 1001 = 7 \cdot 11 \cdot 13, the number is divisible by each.
The divisibility rule for 11 (alternating sum) gives you the answer almost instantly: digits are a, b, c, a, b, c, alternating sum is a - b + c - a + b - c = 0, and 0 is divisible by 11. So the 11 part of the answer falls out of the rule without even factoring 1001.
Why this reflex matters
Students often memorise rules without knowing why they work, which means:
- They cannot remember rules they haven't seen in a while ("wait, is it alternating for 11 or for 7?").
- They cannot derive a rule for an unfamiliar divisor (like 13 or 99).
- They don't notice that many divisibility questions become modular equation questions — which unlocks Euler's theorem, Fermat's little theorem, and many other tools.
Once you see that each rule is a shortcut for "N \bmod m," you get the last bullet for free. The rule is the shortcut; the real engine is the congruence.
Bonus: build a divisibility rule for 99
Applying the formula: 100 \equiv 1 \pmod{99}, so 100^i \equiv 1 for all i. Split N into two-digit blocks from the right, and the sum of those two-digit blocks is congruent to N mod 99. Example: 34 \cdot 99 = 3366. Split into 33 and 66: 33 + 66 = 99, divisible by 99. ✓
You just derived a rule nobody taught you, using only the key idea. That is the reflex in action.
One-line takeaway
Divisibility rules for 3, 4, 5, 8, 9, 10, 11 are all special cases of one fact: N \equiv \sum a_i \cdot 10^i \pmod m, and the rule's shape follows from what 10^i \bmod m looks like. Use the rules in computation, but remember the modular identity behind them — it lets you derive rules for any divisor on demand.
Related: Number Theory Basics · Switch to Mod 10 for Last-Digit Problems · gcd = 1 Unlocks Bézout and Inverses · Factor Into Primes First · Try Small Cases First