TOPICS
Search

Divisibility Tests


In general, an integer n is divisible by d iff the digit sum s_(d+1)(n) is divisible by d.

Write a positive decimal integer a out digit by digit in the form a_n...a_3a_2a_1a_0. The following rules then determine if a is divisible by another number by examining the congruence properties of its digits. In congruence notation, n=k (mod m) means that the remainder when n is divided by a modulus m is k. (Note that it is always true that 10^0=1=1 for any base.)

1. All integers are divisible by 1.

2. 10^1=0 (mod 2), so 10^n=0 (mod 2) for n>=1. Therefore, if the last digit a_0 is divisible by 2 (i.e., is even), then so is a.

3. 10^0=1, 10^1=1, 10^2=1, ..., 10^n=1 (mod 3). Therefore, if the digit sum s_(10)(n)=sum_(i=0)^(n)a_i is divisible by 3, so is a (Wells 1986, p. 48). In general, if the sum of any permutation of the digits of n in any order is divisible by 3, then so is n.

4a. 10^1=2, 10^2=0, ..., 10^n=0 (mod 4). So if the last two digits are divisible by 4, then so is a.

4b. If r=a_0+2a_1 is, then so is a.

5. 10^1=0 (mod 5), so 10^n=0 (mod 5) for n>=1. Therefore, if the last digit a_0 is divisible by 5 (i.e., is 5 or 0), then so is a.

6a. If a is divisible by 3 and is even, then a is also divisible by 6.

6b. 10^1=-2, 10^2=-2, ..., 10^n=-2 (mod 6). Therefore, if r=a_0-2sum_(i=1)^(n)a_i is divisible by 6, so is a. The final number can then, of course, be further reduced using the same procedure.

7a. 10^1=3, 10^2=2, 10^3=-1, 10^4=-3, 10^5=-2, 10^6=1 (mod 7), and the sequence then repeats. Therefore, if r=(a_0+3a_1+2a_2-a_3-3a_4-2a_5)+(a_6+3a_7+...)+... is divisible by 7, so is a. This method was found by Pascal.

7b. An alternate test proceeds by multiplying a_n by 3 and adding to a_(n-1), then repeating the procedure up through a_0. The final number can then, of course, be further reduced using the same procedure. If the result is divisible by 7, then so is the original number (Wells 1986, p. 70).

7c. A third test multiplies a_0 by 5 and adds it to a_1, proceeding up through a_n. The final number can then, of course, be further reduced using the same procedure. If the result is divisible by 7, then so is the original number (Wells 1986, p. 70).

7d. Given a number, form two numbers x and y such that x consists of all digits of the number except the last (units) digit and y is the last digit. Compute x-2y and repeat the procedure. Then the original number is divisible by 7 iff the number in the last step is divisible by 7.

8. 10^1=2, 10^2=4, 10^3=0, ..., 10^n=0 (mod 8). Therefore, if the last three digits are divisible by 8, more specifically if r=a_0+2a_1+4a_2 is, then so is a (Wells 1986, p. 72).

9. (Rule of nines). 10^0=1, 10^1=1, 10^2=1, ..., 10^n=1 (mod 9). Therefore, if the digit sum s_(10)(n)=sum_(i=0)^(n)a_i is divisible by 9, so is a (Wells 1986, p. 74).

10. 10^1=0 (mod 10), so if the last digit is 0, then a is divisible by 10.

11. 10^1=-1, 10^2=1, 10^3=-1, 10^4=1, ... (mod 11). Therefore, if r=a_0-a_1+a_2-a_3+... is divisible by 11, then so is a.

12. 10^1=-2, 10^2=4, 10^3=4, ... (mod 12). Therefore, if r=a_0-2a_1+4(a_2+a_3+...) is divisible by 12, then so is a. Divisibility by 12 can also be checked by seeing if a is divisible by 3 and 4.

13. 10^1=-3, 10^2=-4, 10^3=-1, 10^4=3, 10^5=4, 10^6=1 (mod 13), and the pattern repeats. Therefore, if r=(a_0-3a_1-4a_2-a_3+3a_4+4a_5)+(a_6-3a_7+...)+... is divisible by 13, so is a.

For additional tests for 13, see Gardner (1991).

An interesting piece of English language trivia is that the word "indivisibilities" has more "i"s (in fact, seven of them) than any other common word. (Other words with seven i's include, honorificabilitudinitatibus, indistinguishabilities, indivisibilities, and supercalifragilisticexpialidocious. Phrases with eight i's include "Illinois fighting Illini" and "infinite divisibility." The English word with the most possible i's is floccinaucinihilipilification (nine i's), where "floccinaucinihilipilification" means "the action or habit of estimating as worthless.")


See also

Congruence, Digit Sum, Divisible, Divisor, Modulus, Rule of Nines

Explore with Wolfram|Alpha

References

Burton, D. M. "Special Divisibility Tests." §4.3 in Elementary Number Theory, 4th ed. Boston, MA: Allyn and Bacon, pp. 89-96, 1989.Dickson, L. E. History of the Theory of Numbers, Vol. 1: Divisibility and Primality. New York: Dover, pp. 337-346, 2005.Gardner, M. "Tests of Divisibility." Ch. 14 in The Unexpected Hanging and Other Mathematical Diversions. Chicago, IL: Chicago University Press, pp. 160-169, 1991.Wells, D. The Penguin Dictionary of Curious and Interesting Numbers. Middlesex, England: Penguin Books, p. 48, 1986.

Referenced on Wolfram|Alpha

Divisibility Tests

Cite this as:

Weisstein, Eric W. "Divisibility Tests." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/DivisibilityTests.html

Subject classifications