Divisibility tests [00EO]
- April 16, 2026
Example [00EP]
- April 16, 2026
Is 7431 prime? No, it’s divisible by 3 since the sum of its digits is. Many of you perhaps know this divisibility rule, but do you know why it works?
Theorem Testing for divisibility by 3 [00EQ]
- April 16, 2026
A number is divisible by 3 iff the sum of its digits in base 10 is also divisible by 3.
Note this process can be iterated: for example, 7431 is divisible by 3 if and only if 7 + 4 + 3 + 1 = 15 is; and 15 in turn is divisible by 3 if and only if 1 + 5 = 6 is.
Proof.
- April 16, 2026
Remark Testing for divisibility by 2 and 5 [00ER]
- April 16, 2026
This also shows why for 2 and 5 we can just look at the last digit: since 2 and 5 are both divisors of 10, we have 10 \equiv _2 0 and 10 \equiv _5 0. So replacing 10 with 0 in the expansion for n tells us that n \equiv _2 d_0 and n \equiv _5 d_0.
Testing for divisibility by 7 [00ES]
- April 16, 2026
What about 7? Let n be a positive integer and write n = 10m + d_0. For example, if n = 7451 we have m = 745 and d_0 = 1. We reason as follows:
Thus, n is divisible by 7 if and only if m - 2d_0 is. That is, we take the last digit of n, double it, and subtract from the number formed by the rest of the digits. For example, doing this process on 7451 yields 745 - 2\cdot 1 = 743; doing it again yields 74 - 2 \cdot 3 = 68, and 68 is not divisible by 7 (it is 7\cdot 10 - 2). On the other hand, 7441 yields 742, which yields 70, which is divisible by 7, and indeed, 163 \cdot 7 = 7441.
Note, there is actually a key piece missing from our proof above: although we proved that we can always multiply both sides of a modular equivalence by the same number (-2 in this case), we don’t yet know that we can divide both sides by the same number, which we need for that step to be an if and only if. In fact, sometimes we can’t! But it turns out this step is allowed since 2 and 7 share no common factors. We will prove this later in the week.