Divisibility Tests and Digit Sums
Quick tricks for checking whether a number divides evenly by another, using patterns in its digits — a staple of mental-math interview questions.
Divisibility tests let you check whether one number splits evenly into another without doing the actual division, by looking only at its digits. They come up constantly in interview mental-math rounds because they turn a seemingly hard division into a fast pattern match.
The most useful one is for 3 and 9: a number is divisible by 3 (or 9) exactly when the sum of its digits is divisible by 3 (or 9). For example, 4,827 has digit sum , which is divisible by 3 but not 9, so 4,827 is divisible by 3 but not 9. This works because each power of ten is more than a multiple of (), so a number's remainder mod 9 equals its digit sum's remainder mod 9. For 11, alternate the digits with plus and minus signs and check if that alternating sum is divisible by 11 — for 4,827 that's , not divisible by 11. Simpler still: a number is divisible by 2 if its last digit is even, by 5 if it ends in 0 or 5, and by 4 if its last two digits form a number divisible by 4.
In an interview, the value isn't reciting the rules — it's recognizing which test applies fastest and combining them: to check divisibility by 6, test by 2 and by 3 separately, since .
Divisibility by 3 or 9 only ever needs the digit sum, because every power of ten leaves remainder 1 when divided by 9.
Related concepts
Practice in interviews
Further reading
- Engel, Problem-Solving Strategies, ch. 1