Divisibility Criteria

Casting out nines

We study now some useful applications that make use of the congruence. Casting out of nines is a necessary condition to check the exactness of a multiplication. We try first to understand what's behind this method and what the number 9 has to do with it. Let a be an integer, and let a0, a1, ..., an be its decimal digits. In other words,

a = an 10n + an−110n−1 + ... + a1 10 + a0   (4.3)

where 0 ≤ ai ≤ 9 for i = 0,...,n.

A number as 2134 corresponds to

2⋅103 + 1⋅102 + 3⋅101 + 4⋅100

Whatever n > 0

10n − 1 = 999...9 = 9 ⋅ 111 ... 1
       n times     n times

i.e. 10n ≡ 1 (mod 9)

by using the properties of congruences,

2134 = 2⋅103 + 1⋅102 + 3⋅101 + 4⋅100 ≡ 2 + 1 + 3 + 4   (mod 9)

thus any integer number, written in decimal notation is congruent modulo 9 to the sum of its digits.

Suppose we want to multiply two integers: 3455 ⋅ 2134, obtaining as result 7282970. We want to check the exactness of the result. We proceed as follows: write the sum of the digits of each number:

3455 → 3 + 4 + 5 + 5 = 17 → 1 + 7 = 8;

2134 → 2 + 1 + 3 + 4 = 10 → 1 + 0 = 1;

7282970 → 7 + 2 + 8 + 2 + 9 + 7 + 0 = 35 → 3 + 5 = 8;

and them multiply the sums obtained by each other 8 ⋅ 1: if the result is correct this number is equal to the the sum of the digits in the result 35 = 3 + 5 = 8.

Indeed we know from the discussion above that 3455 ≡9 8, 2134 ≡9 1 e 7282970 ≡9 8. Thus 3455 ⋅ 2134 ≡9 8 ⋅ 1 = 8.

If instead of 8 we would have obtained a different number that would have signified with certainty that the result of the multiplation was incorrect. However, having obtained 8, does not guarentee the corecteness of the result.

Divisibility criteria

Per studiare la divisibilità di un numero per n sfruttiano le seguenti relazioni.

z = z1 (mod n)  ⇒  z− z1 = nh  ⇒  z = z1 + nh

Dato che la somma di due numeri divisibili per n (cioè z1 e n) è ancora un numero divisibile per n, allora z sarà divisibile per n se lo è anche z1.

Proposition 4.11. A number is dibisible by 3 (by 9), only if the sum of its digits is divisible by 3 (by 9).

Proof. The reason this divisibility test works is easy to detect. If we write an integer z as

z = an 10n + an−110n−1 + ... + a1 10 + a0

in terms of its digits an, an−1, a1, a0, then the sum S of its digits is

S = an + an−1 + ... + a1 + a0

So, the difference between z and the sum S of its digits is

zS = a1 · 9 + a2 · 99 + ··· + an · 999...9,

which is divisible by 3. Thus,

zS (mod 3).

Hence z is divisible by 3 (by 9) if and only if the sum S of its digits is divisible by 3 (by 9). □

Proposition 4.12. An integer number is divisible by 2 or by 5 if and only if its rightmost digit, is divisible by 2 or by 5;

Proof. For each n > 0, 10n ≡ 0 both mod 2 and mod 5. So, za0 both mod 2 and mod 5, and this proves the corresponding divisibility tests. □

Proposition 4.13. An integer number is divisible by 4 (or by 25, respectively) if and only if the number (a1a0) formed by its last two digits a1a0 is divisible by 4 (or by 25, respectively);

Proof. 100 = 22 52 ≡ 0 both modulo 4 and modulo 25, and so every integer is congruent modulo 4 and modulo 25 to the integer formed by its rightmost two digits.□

Proposition 4.14. An integer z = (an + an−1 + ... + a1 + a0)10 is divisible by 2k if and only if 2k divides the number (ak−1 ak−2, ..., a1a0)10 formed by the last k digits of z.

Proof. 10n = 2n 5n ≡ 0 (mod 2k) for all nk, proving the divisibility test for 2k. In particular, an integer is divisible by 8 if and only if (a2 a1 a0)10 is divisible by 8. □

Divisibility by 6. If the given number is divisible by both 2 and 3. The number 619230 has 0 as last digit, so it is divisible by 2, and the sum of its digits is 21 which is divisible by 3.

Proposition 4.15 (Divisibility by 7). To determine whether n is divisible by 7, we take the last digit, double it and subtract it from the first part of the number. If you get an answer divisible by 7, then the original number is divisible by 7. You may have to apply the rule repeatedly. The result of the divisibility test for 7 will not only determine divisibility, but also the remainder upon dividing by 7.

Example 4.16. Take 8631. Split into 863 and 1. Subtract 1x2 = 2 from 863 to get 861. Now split 861 into 86 and 1. Subtract 2 from 86. Maybe you recognize 84 as a multiple of 7. If not, double 4 and subtract from 8 to get 0, which is divisible by 7.

Take 522. Split into 52 and 2. Subtract 4 from 52 to get 50. Since 50 isn’t divisible by 7, neither is 522.

Proof. Let n consist of two parts: A, which contains all digits aside from the units digit, and B, the units digit, so that the numerical value of N is 10A + b. We want to show that, iff A − 2B is a multiple of 7, then so is n. Setting A − 2B = 7k for some positive integer k, we multiply both sides by 10 to obtain 10A − 20B = 70k. Adding 21B to both sides yields 10A + B = 70k + 21 = 7(10k + 3), as desired.

Next we prove the contrary. If we suppose 10A + B = 7k for some positive integer k, then 10A − 20B = 7k − 21B (after subtraction of 21B from both sides) and 10(A − 2B) = 7(k − 3B). This implies that A − 2B, is a multiple of 7. This completes the proof.  □

Proposition 4.17. An integer is divisible by 11 if and only if the sum of its digits taken with alternating signs

(−1)nan + ... − a1 + a0

is divisible by 11.

Proof. Notice that 10 ≡ −1 (mod 11), we can write

z = a0 · 1 + a1 · 10 + a2 · 102 + ··· + an · 10na0 · 1 + a1 · (−1) + a2 · (−1)2 + · · · + an · (−1)n (mod 11)

and z is congruent to the alternating sum of its digits. □

« Congruenza modulare Index Linear Congruences »