Divisibility rules are not tricks to memorise — they are theorems about what happens to a number's digits modulo small primes. Each rule has a one-line proof.
Why does the rule for 3 use the sum of digits, while the rule for 4 uses only the last two digits?
These are not arbitrary mnemonics. They are consequences of a single idea: the value of each digit depends on its position, and different moduli react differently to powers of 10.
The underlying idea
Every positive integer n can be written in terms of its digits:
n=dk⋅10k+dk−1⋅10k−1+⋯+d1⋅10+d0
To check if m∣n, reduce modulo m:
n≡dk⋅(10kmodm)+⋯+d1⋅(10modm)+d0(modm)
The rule for m depends entirely on the pattern of 10kmodm.
Rule for 2 and 5
10≡0(mod2) and 10≡0(mod5).
So 10k≡0 for all k≥1, meaning all digits except the last vanish:
n≡d0(mod2)andn≡d0(mod5)
Rule. 2∣n⟺ last digit is 0,2,4,6, or 8.
Rule. 5∣n⟺ last digit is 0 or 5.
Rule for 4 and 25
100≡0(mod4) and 100≡0(mod25).
So 10k≡0 for all k≥2:
n≡d1⋅10+d0(mod4)andn≡d1⋅10+d0(mod25)
Rule. 4∣n⟺4 divides the last two digits.
Rule. 25∣n⟺25 divides the last two digits.
Example. 4∣1836? Last two digits: 36=4×9. Yes.
Rule for 8 and 125
1000≡0(mod8) and 1000≡0(mod125).
Rule. 8∣n⟺8 divides the last three digits.
Rule. 125∣n⟺125 divides the last three digits.
Rule for 3 and 9
10≡1(mod3) and 10≡1(mod9).
So 10k≡1k=1 for all k:
n≡dk+dk−1+⋯+d1+d0(mod3)
Rule. 3∣n⟺3 divides the sum of digits of n.
Rule. 9∣n⟺9 divides the sum of digits of n.
Example. Is 3∣47382? Sum of digits: 4+7+3+8+2=24, and 3∣24. Yes.
Why casting out nines works. Since any digit d contributes d(mod9), and 9≡0(mod9), you can drop any 9s or digit groups summing to 9. The remainder is the same.
Rule for 11
10≡−1(mod11), so 10k≡(−1)k(mod11):
n≡d0−d1+d2−d3+⋯(mod11)
Rule. 11∣n⟺11 divides the alternating sum of digits (starting from the right with +).
Example. Is 11∣85437?
Alternating sum: 7−3+4−5+8=11. Yes, 11∣85437.
Example. Is 11∣9 (i.e., 9)? Alternating sum is 9. 11∤9. No.
Rule for 7
10≡3(mod7). The powers of 3 mod 7 cycle with period 6:
30≡1,31≡3,32≡2,33≡6,34≡4,35≡5,36≡1 …
So 10k(mod7) cycles: 1,3,2,6,4,5,1,3,2,…
There is no clean digit-sum rule for 7. The standard approach:
Practical method. Double the last digit, subtract from the rest. Repeat until small.
7∣n⟺7∣(number without last digit)−2×(last digit)
Why. If n=10q+d0, then n−2d0=10q+d0−2d0=10q−d0. And 7∣10q−d0⟺7∣10(10q−d0)=100q−10d0≡2q−3d0... the cleaner proof: n≡0(mod7)⟺10q+d0≡0⟺3q+d0≡0⟺q≡−d0⋅3−1≡−d0⋅5≡2d0(mod7)... the doubling-and-subtracting shortcut collapses this.
Example. Is 7∣874?
87−2(4)=87−8=79.
7−2(9)=7−18=−11.
7∤−11, so 7∤874.
Rule for 13
10≡10(mod13), and powers of 10 mod 13 cycle with period 6:
1,10,9,12,3,4,1,10,…
Practical method. Multiply the last digit by 4, add to the rest. Repeat.
13∣n⟺13∣(number without last digit)+4×(last digit)
Summary table
| Divisor | Key congruence | Rule |
|---|
| 2 | 10≡0 | Last digit even |
| 3 | 10≡1 | Sum of digits divisible by 3 |
| 4 | 100≡0 | Last two digits divisible by 4 |
| 5 | 10≡0 | Last digit is 0 or 5 |
| 7 | 10≡3, period 6 | Double last digit, subtract |
| 8 | 1000≡0 | Last three digits divisible by 8 |
| 9 | 10≡1 | Sum of digits divisible by 9 |
| 11 | 10≡−1 | Alternating digit sum |
| 13 | 10≡10, period 6 | Multiply last digit by 4, add |
| 25 | 100≡0 | Last two digits divisible by 25 |
Worked problems
Problem 1. Find the smallest 5-digit number divisible by 9 with digit sum 18.
Digit sum 18 guarantees divisibility by 9. Smallest 5-digit: 10008 — digit sum 1+0+0+0+8=9. Not 18.
Try 10008's neighbors... actually minimize: put the largest digits at the end. 10008 has sum 9. We want sum 18. Minimum 5-digit with sum 18: 10089 (sum: 1+0+0+8+9=18). Check: 10089/9=1121. ✓
Problem 2. A 6-digit number 1a2b3c is divisible by 11. Find the relationship between a, b, and c.
Alternating sum (right to left): c−3+b−2+a−1=a+b+c−6.
For divisibility by 11: 11∣a+b+c−6, so a+b+c≡6(mod11).
Since a,b,c∈{0,…,9}, the sum a+b+c∈{0,…,27}, giving a+b+c∈{6,17}.
Problem 3. Prove that 10n−1 is always divisible by 9.
10≡1(mod9), so 10n≡1(mod9), giving 10n−1≡0(mod9). ■
This is why the digit-sum rule works: n−(digit sum)= a multiple of 9 always.
Problem 4. Show that no perfect square ends in 2, 3, 7, or 8.
Squares mod 10: 02=0,12=1,22=4,32=9,42=6,52=5,62=6,72=9,82=4,92=1.
Last digits of squares: {0,1,4,5,6,9} only. The digits 2, 3, 7, 8 never appear. ■