Divisibility rule


A divisibility rule is a shorthand way of determining whether a given integer is divisible by a fixed divisor without performing the division, usually by examining its digits. Although there are divisibility tests for numbers in any radix, or base, and they are all different, this article presents rules and examples only for decimal, or base 10, numbers. Martin Gardner explained and popularized these rules in his September 1962 "Mathematical Games" column in Scientific American.

Divisibility rules for numbers 1–30

The rules given below transform a given number into a generally smaller number, while preserving divisibility by the divisor of interest. Therefore, unless otherwise noted, the resulting number should be evaluated for divisibility by the same divisor. In some cases the process can be iterated until the divisibility is obvious; for others the result must be examined by other means.
For divisors with multiple rules, the rules are generally ordered first for those appropriate for numbers with many digits, then those useful for numbers with fewer digits.
Note: To test divisibility by any number that can be expressed as 2n or 5n, in which n is a positive integer, just examine the last n digits.
Note: To test divisibility by any number expressed as the product of prime factors, we can separately test for divisibility by each prime to its appropriate power. For example, testing divisibility by 24 is equivalent to testing divisibility by 8 and 3 simultaneously, thus we need only show divisibility by 8 and by 3 to prove divisibility by 24.
DivisorDivisibility conditionExamples
1No special condition. Any integer is divisible by 1.2 is divisible by 1.
2The last digit is even.1294: 4 is even.
3Sum the digits. The result must be [|divisible by 3].405 → 4 + 0 + 5 = 9 and 636 → 6 + 3 + 6 = 15 which both are clearly divisible by 3.
16,499,205,854,376 → 1+6+4+9+9+2+0+5+8+5+4+3+7+6 sums to 69 → 6 + 9 = 15 → 1 + 5 = 6, which is clearly divisible by 3.
3Subtract the quantity of the digits 2, 5, and 8 in the number from the quantity of the digits 1, 4, and 7 in the number. The result must be divisible by 3.Using the example above: 16,499,205,854,376 has four of the digits 1, 4 and 7 and four of the digits 2, 5 and 8; ∴ Since 4 − 4 = 0 is a multiple of 3, the number 16,499,205,854,376 is divisible by 3.
4The last two digits form a number that is divisible by 4.40,832: 32 is divisible by 4.
4If the tens digit is even, the ones digit must be 0, 4, or 8.
If the tens digit is odd, the ones digit must be 2 or 6.
40,832: 3 is odd, and the last digit is 2.
4Twice the tens digit, plus the ones digit is divisible by 4.40832: 2 × 3 + 2 = 8, which is divisible by 4.
5The last digit is 0 or 5.495: the last digit is 5.
6It is [|divisible by 2] and by 3.1458: 1 + 4 + 5 + 8 = 18, so it is divisible by 3 and the last digit is even, hence the number is divisible by 6.
7Forming an alternating sum of blocks of three from right to left gives a multiple of 71,369,851: 851 − 369 + 1 = 483 = 7 × 69
7Adding 5 times the last digit to the rest gives a multiple of 7. 483: 48 + = 63 = 7 × 9.
7Subtracting 2 times the last digit from the rest gives a multiple of 7. 483: 48 − = 42 = 7 × 6.
7Subtracting 9 times the last digit from the rest gives a multiple of 7.483: 48 − = 21 = 7 × 3.
7Adding 3 times the first digit to the next and then writing the rest gives a multiple of 7. 483: 4×3 + 8 = 20,
203: 2×3 + 0 = 6,
63: 6×3 + 3 = 21.
7Adding the last two digits to twice the rest gives a multiple of 7. 483,595: 95 + = 9765: 65 + = 259: 59 + = 63.
7Multiply each digit by the digit in the corresponding position in this pattern : 1, 3, 2, -1, -3, -2. Adding the results gives a multiple of 7.483,595: + + + + + = 7.
7Adding the last digit to 3 times the rest gives a multiple of 7.224: 4 + = 70
7Adding 3 times the last digit to 2 times the rest gives a multiple of 7.245: + = 7 x 9 = 63
8If the hundreds digit is even, the number formed by the last two digits must be divisible by 8.624: 24.
8If the hundreds digit is odd, the number obtained by the last two digits plus 4 must be divisible by 8.352: 52 + 4 = 56.
8Add the last digit to twice the rest. The result must be divisible by 8.56: + 6 = 16.
8The last three digits are divisible by 8.34,152: Examine divisibility of just 152: 19 × 8
8Add four times the hundreds digit to twice the tens digit to the ones digit. The result must be divisible by 8.34,152: 4 × 1 + 5 × 2 + 2 = 16
9Sum the digits. The result must be divisible by 9.2880: 2 + 8 + 8 + 0 = 18: 1 + 8 = 9.
10The ones digit is 0.130: the ones digit is 0.
11Form the alternating sum of the digits. The result must be divisible by 11.918,082: 9 − 1 + 8 − 0 + 8 − 2 = 22 = 2 × 11.
11Add the digits in blocks of two from right to left. The result must be divisible by 11.627: 6 + 27 = 33 = 3 × 11.
11Subtract the last digit from the rest. The result must be divisible by 11.627: 62 − 7 = 55 = 5 × 11.
11Add the last digit to the hundreds place. The result must be divisible by 11.627: 62 + 70 = 132: 13 + 20 = 33 = 3 × 11.
11If the number of digits is even, add the first and subtract the last digit from the rest. The result must be divisible by 11.918,082: the number of digits is even → 1808 + 9 − 2 = 1815: 81 + 1 − 5 = 77 = 7 × 11
11If the number of digits is odd, subtract the first and last digit from the rest. The result must be divisible by 11.14,179: the number of digits is odd → 417 − 1 − 9 = 407 = 37 × 11
12It is divisible by 3 and by 4.324: it is divisible by 3 and by 4.
12Subtract the last digit from twice the rest. The result must be divisible by 12.324: 32 × 2 − 4 = 60 = 5 × 12.
13Form the alternating sum of blocks of three from right to left. The result must be divisible by 13.2,911,272: 272 - 911 + 2 = -637
13Add 4 times the last digit to the rest. The result must be divisible by 13.637: 63 + 7 × 4 = 91, 9 + 1 × 4 = 13.
13Subtract the last two digits from four times the rest. The result must be divisible by 13.923: 9 × 4 - 23 = 13.
13Subtract 9 times the last digit from the rest. The result must be divisible by 13.637: 63 - 7 × 9 = 0.
14It is divisible by 2 and by 7.224: it is divisible by 2 and by 7.
14Add the last two digits to twice the rest. The result must be divisible by 14.364: 3 × 2 + 64 = 70.
1764: 17 × 2 + 64 = 98.
15It is divisible by 3 and by 5.390: it is divisible by 3 and by 5.
16If the thousands digit is even, the number formed by the last three digits must be divisible by 16.254,176: 176.
16If the thousands digit is odd, the number formed by the last three digits plus 8 must be divisible by 16.3408: 408 + 8 = 416.
16Add the last two digits to four times the rest. The result must be divisible by 16.176: 1 × 4 + 76 = 80.
1168: 11 × 4 + 68 = 112.
16The last four digits must be divisible by 16.157,648: 7,648 = 478 × 16.
17Subtract 5 times the last digit from the rest.221: 22 − 1 × 5 = 17.
17Subtract the last two digits from two times the rest.4,675: 46 × 2 - 75 = 17.
17Add 9 times the last digit to 5 times the rest. Drop trailing zeroes.4,675: 467 × 5 + 5 × 9 = 2380; 238: 23 × 5 + 8 × 9 = 187.
18It is divisible by 2 and by 9.342: it is divisible by 2 and by 9.
19Add twice the last digit to the rest.437: 43 + 7 × 2 = 57.
19Add 4 times the last two digits to the rest.6935: 69 + 35 × 4 = 209.
20It is divisible by 10, and the tens digit is even.360: is divisible by 10, and 6 is even.
20The number formed by the last two digits is divisible by 20.480: 80 is divisible by 20.
21Subtracting twice the last digit from the rest gives a multiple of 21.168: 16 − 8 × 2 = 0.
21It is divisible by 3 and by 7.231: it is divisible by 3 and by 7.
22It is divisible by 2 and by 11.352: it is divisible by 2 and by 11.
23Add 7 times the last digit to the rest.3128: 312 + 8 × 7 = 368. 36 + 8 × 7 = 92.
23Add 3 times the last two digits to the rest.1725: 17 + 25 × 3 = 92.
24It is divisible by 3 and by 8.552: it is divisible by 3 and by 8.
25Examine the number formed by the last two digits.134,250: 50 is divisible by 25.
26It is divisible by 2 and by 13.156: it is divisible by 2 and by 13.
26Subtracting 5 times the last digit from 2 times the rest of the number gives a multiple of 261248 : - =208=26×8
27Sum the digits in blocks of three from right to left.2,644,272: 2 + 644 + 272 = 918.
27Subtract 8 times the last digit from the rest.621: 62 − 1 × 8 = 54.
27Subtract the last two digits from 8 times the rest.6507: 65 × 8 - 7 = 520 - 7 = 513 = 27 × 19.
28It is divisible by 4 and by 7.140: it is divisible by 4 and by 7.
29Add three times the last digit to the rest.348: 34 + 8 × 3 = 58.
29Add 9 times the last two digits to the rest.5510: 55 + 10 × 9 = 145 = 5 × 29.
30It is divisible by 3 and by 10.270: it is divisible by 3 and by 10.

Step-by-step examples

Divisibility by 2

First, take any number and note the last digit in the number, discarding the other digits. Then take that digit while ignoring the rest of the number and determine if it is divisible by 2. If it is divisible by 2, then the original number is divisible by 2.
Example
  1. 376
  2. 37 6
  3. 6 ÷ 2 = 3
  4. 376 ÷ 2 = 188

    Divisibility by 3 or 9

First, take any number and add together each digit in the number. Then take that sum and determine if it is divisible by 3. The original number is divisible by 3 if and only if the sum of its digits is divisible by 3.
If a number is a multiplication of 3 consecutive numbers then that number is always divisible by 3. This is useful for when the number takes the form of × )
Example.
  1. 492
  2. 4 + 9 + 2 = 15
  3. 15 is divisible by 3 at which point we can stop. Alternatively we can continue using the same method if the number is still too large:
  4. 1 + 5 = 6
  5. 6 ÷ 3 = 2
  6. 492 ÷ 3 = 164
Example.
  1. 336
  2. 6 × 7 × 8 = 336
  3. 336 ÷ 3 = 112

    Divisibility by 4

The basic rule for divisibility by 4 is that if the number formed by the last two digits in a number is divisible by 4, the original number is divisible by 4; this is because 100 is divisible by 4 and so adding hundreds, thousands, etc. is simply adding another number that is divisible by 4. If any number ends in a two digit number that you know is divisible by 4, then the whole number will be divisible by 4 regardless of what is before the last two digits.
Alternatively, one can simply divide the number by 2, and then check the result to find if it is divisible by 2. If it is, the original number is divisible by 4. In addition, the result of this test is the same as the original number divided by 4.
Example.
General rule
  1. 2092
  2. 20 92
  3. 92 ÷ 4 = 23
  4. 2092 ÷ 4 = 523
Alternative example
  1. 1720
  2. 1720 ÷ 2 = 860
  3. 860 ÷ 2 = 430
  4. 1720 ÷ 4 = 430

    Divisibility by 5

Divisibility by 5 is easily determined by checking the last digit in the number, and seeing if it is either 0 or 5. If the last number is either 0 or 5, the entire number is divisible by 5.
If the last digit in the number is 0, then the result will be the remaining digits multiplied by 2. For example, the number 40 ends in a zero, so take the remaining digits and multiply that by two. The result is the same as the result of 40 divided by 5.
If the last digit in the number is 5, then the result will be the remaining digits multiplied by two, plus one. For example, the number 125 ends in a 5, so take the remaining digits, multiply them by two, then add one. The result is the same as the result of 125 divided by 5.
Example.
If the last digit is 0
  1. 110
  2. 11 0
  3. 11 0
  4. 11 × 2 = 22
  5. 110 ÷ 5 = 22
If the last digit is 5
  1. 85
  2. 8 5
  3. 8 5
  4. 8 × 2 = 16
  5. 16 + 1 = 17
  6. 85 ÷ 5 = 17

    Divisibility by 6

Divisibility by 6 is determined by checking the original number to see if it is both an even number and divisible by 3. This is the best test to use.
If the number is divisible by six, take the original number and divide it by two. Then, take that result and divide it by three. This result is the same as the original number divided by six.
Example.
;General rule
  1. 324
  2. 324 ÷ 3 = 108
  3. 324 ÷ 2 = 162 OR 108 ÷ 2 = 54
  4. 324 ÷ 6 = 54
;Finding a remainder of a number when divided by 6:
Example: What is the remainder when 1036125837 is divided by 6?

Divisibility by 7

Divisibility by 7 can be tested by a recursive method. A number of the form 10x + y is divisible by 7 if and only if x − 2y is divisible by 7. In other words, subtract twice the last digit from the number formed by the remaining digits. Continue to do this until a number known to be divisible by 7 is obtained. The original number is divisible by 7 if and only if the number obtained using this procedure is divisible by 7. For example, the number 371: 37 − = 37 − 2 = 35; 3 − = 3 − 10 = −7; thus, since −7 is divisible by 7, 371 is divisible by 7.
Similarly a number of the form 10x + y is divisible by 7 if and only if x + 5y is divisible by 7. So add five times the last digit to the number formed by the remaining digits, and continue to do this until a number known to be divisible by 7 is obtained.
Another method is multiplication by 3. A number of the form 10x + y has the same remainder when divided by 7 as 3x + y. One must multiply the leftmost digit of the original number by 3, add the next digit, take the remainder when divided by 7, and continue from the beginning: multiply by 3, add the next digit, etc. For example, the number 371: 3×3 + 7 = 16 remainder 2, and 2×3 + 1 = 7. This method can be used to find the remainder of division by 7.
A more complicated algorithm for testing divisibility by 7 uses the fact that 100 ≡ 1, 101 ≡ 3, 102 ≡ 2, 103 ≡ 6, 104 ≡ 4, 105 ≡ 5, 106 ≡ 1,... . Take each digit of the number in reverse order, multiplying them successively by the digits 1, 3, 2, 6, 4, 5, repeating with this sequence of multipliers as long as necessary, and adding the products. The original number is divisible by 7 if and only if the number obtained using this procedure is divisible by 7.
This method can be simplified by removing the need to multiply. All it would take with this simplification is to memorize the sequence above, and to add and subtract, but always working with one-digit numbers.
The simplification goes as follows:
If through this procedure you obtain a 0 or any recognizable multiple of 7, then the original number is a multiple of 7. If you obtain any number from 1 to 6, that will indicate how much you should subtract from the original number to get a multiple of 7. In other words, you will find the remainder of dividing the number by 7. For example, take the number 186:
Now we have a number lower than 7, and this number is the remainder of dividing 186/7. So 186 minus 4, which is 182, must be a multiple of 7.
Note: The reason why this works is that if we have: a+b=c and b is a multiple of any given number n, then a and c will necessarily produce the same remainder when divided by n. In other words, in 2 + 7 = 9, 7 is divisible by 7. So 2 and 9 must have the same reminder when divided by 7. The remainder is 2.
Therefore, if a number n is a multiple of 7, then adding multiples of 7 cannot change that property.
What this procedure does, as explained above for most divisibility rules, is simply subtract little by little multiples of 7 from the original number until reaching a number that is small enough for us to remember whether it is a multiple of 7. If 1 becomes a 3 in the following decimal position, that is just the same as converting 10×10n into a 3×10n. And that is actually the same as subtracting 7×10n from 10×10n.
Similarly, when you turn a 3 into a 2 in the following decimal position, you are turning 30×10n into 2×10n, which is the same as subtracting 30×10n−28×10n, and this is again subtracting a multiple of 7. The same reason applies for all the remaining conversions:
First method example
1050 → 105 − 0=105 → 10 − 10 = 0. ANSWER: 1050 is divisible by 7.
Second method example
1050 → 0501 → 0×1 + 5×3 + 0×2 + 1×6 = 0 + 15 + 0 + 6 = 21. ANSWER: 1050 is divisible by 7.
Vedic method of divisibility by osculation
Divisibility by seven can be tested by multiplication by the Ekhādika. Convert the divisor seven to the nines family by multiplying by seven. 7×7=49. Add one, drop the units digit and, take the 5, the Ekhādika, as the multiplier. Start on the right. Multiply by 5, add the product to the next digit to the left. Set down that result on a line below that digit. Repeat that method of multiplying the units digit by five and adding that product to the number of tens. Add the result to the next digit to the left. Write down that result below the digit. Continue to the end. If the end result is zero or a multiple of seven, then yes, the number is divisible by seven. Otherwise, it is not. This follows the Vedic ideal, one-line notation.
Vedic method example:
Is 438,722,025 divisible by seven? Multiplier = 5.
4 3 8 7 2 2 0 2 5
42 37 46 37 6 40 37 27
YES
Pohlman–Mass method of divisibility by 7
The Pohlman–Mass method provides a quick solution that can determine if most integers are divisible by seven in three steps or less. This method could be useful in a mathematics competition such as MATHCOUNTS, where time is a factor to determine the solution without a calculator in the Sprint Round.
Step A:
If the integer is 1,000 or less, subtract twice the last digit from the number formed by the remaining digits. If the result is a multiple of seven, then so is the original number. For example:
112 -> 11 − = 11 − 4 = 7 YES
98 -> 9 − = 9 − 16 = −7 YES
634 -> 63 − = 63 − 8 = 55 NO
Because 1,001 is divisible by seven, an interesting pattern develops for repeating sets of 1, 2, or 3 digits that form 6-digit numbers in that all such numbers are divisible by seven. For example:
001 001 = 1,001 / 7 = 143
010 010 = 10,010 / 7 = 1,430
011 011 = 11,011 / 7 = 1,573
100 100 = 100,100 / 7 = 14,300
101 101 = 101,101 / 7 = 14,443
110 110 = 110,110 / 7 = 15,730
01 01 01 = 10,101 / 7 = 1,443
10 10 10 = 101,010 / 7 = 14,430
111,111 / 7 = 15,873
222,222 / 7 = 31,746
999,999 / 7 = 142,857
576,576 / 7 = 82,368
For all of the above examples, subtracting the first three digits from the last three results in a multiple of seven. Notice that leading zeros are permitted to form a 6-digit pattern.
This phenomenon forms the basis for Steps B and C.
Step B:
If the integer is between 1,001 and one million, find a repeating pattern of 1, 2, or 3 digits that forms a 6-digit number that is close to the integer. If the positive difference is less than 1,000, apply Step A. This can be done by subtracting the first three digits from the last three digits. For example:
341,355 − 341,341 = 14 -> 1 − = 1 − 8 = −7 YES
67,326 − 067,067 = 259 -> 25 − = 25 − 18 = 7 YES
The fact that 999,999 is a multiple of 7 can be used for determining divisibility of integers larger than one million by reducing the integer to a 6-digit number that can be determined using Step B. This can be done easily by adding the digits left of the first six to the last six and follow with Step A.
Step C:
If the integer is larger than one million, subtract the nearest multiple of 999,999 and then apply Step B. For even larger numbers, use larger sets such as 12-digits and so on. Then, break the integer into a smaller number that can be solved using Step B. For example:
22,862,420 − = 22,862,420 − 21,999,978 -> 862,420 + 22 = 862,442
862,442 -> 862 − 442 = 420 -> 42 − = 42 YES
This allows adding and subtracting alternating sets of three digits to determine divisibility by seven. Understanding these patterns allows you to quickly calculate divisibility of seven as seen in the following examples:
Pohlman–Mass method of divisibility by 7, examples:
Is 98 divisible by seven?
98 -> 9 − = 9 − 16 = −7 YES
Is 634 divisible by seven?
634 -> 63 − = 63 − 8 = 55 NO
Is 355,341 divisible by seven?
355,341 − 341,341 = 14,000 -> 014 − 000 -> 14 = 1 − = 1 − 8 = −7 YES
Is 42,341,530 divisible by seven?
42,341,530 -> 341,530 + 42 = 341,572
341,572 − 341,341 = 231
231 -> 23 − = 23 − 2 = 21 YES
Using quick alternating additions and subtractions:
42,341,530 -> 530 − 341 + 42 = 189 + 42 = 231 -> 23 − = 21 YES
Multiplication by 3 method of divisibility by 7, examples:
Is 98 divisible by seven?
98 -> 9 remainder 2 -> 2×3 + 8 = 14 YES
Is 634 divisible by seven?
634 -> 6×3 + 3 = 21 -> remainder 0 -> 0×3 + 4 = 4 NO
Is 355,341 divisible by seven?
3 * 3 + 5 = 14 -> remainder 0 -> 0×3 + 5 = 5 -> 5×3 + 3 = 18 -> remainder 4 -> 4×3 + 4 = 16 -> remainder 2 -> 2×3 + 1 = 7 YES
Find remainder of 1036125837 divided by 7
1×3 + 0 = 3
3×3 + 3 = 12 remainder 5
5×3 + 6 = 21 remainder 0
0×3 + 1 = 1
1×3 + 2 = 5
5×3 + 5 = 20 remainder 6
6×3 + 8 = 26 remainder 5
5×3 + 3 = 18 remainder 4
4×3 + 7 = 19 remainder 5
Answer is 5
Finding remainder of a number when divided by 7
7 − Period: 6 digits.
Recurring numbers: 1, 3, 2, −1, −3, −2
Minimum magnitude sequence
Period: 6 digits.
Recurring numbers: 1, 3, 2, 6, 4, 5
Positive sequence
Multiply the right most digit by the left most digit in the sequence and multiply the second right most digit by the second left most digit in the sequence and so on and so for. Next, compute the sum of all the values and take the modulus of 7.
Example: What is the remainder when 1036125837 is divided by 7?
Multiplication of the rightmost digit = 1 × 7 = 7
Multiplication of the second rightmost digit = 3 × 3 = 9
Third rightmost digit = 8 × 2 = 16
Fourth rightmost digit = 5 × −1 = −5
Fifth rightmost digit = 2 × −3 = −6
Sixth rightmost digit = 1 × −2 = −2
Seventh rightmost digit = 6 × 1 = 6
Eighth rightmost digit = 3 × 3 = 9
Ninth rightmost digit = 0
Tenth rightmost digit = 1 × −1 = −1
Sum = 33
33 modulus 7 = 5
Remainder = 5
Digit pair method of divisibility by 7
This method uses 1, −3, 2 pattern on the digit pairs. That is, the divisibility of any number by seven can be tested by first separating the number into digit pairs, and then applying the algorithm on three digit pairs. When the number is smaller than six digits, then fill zero’s to the right side until there are six digits. When the number is larger than six digits, then repeat the cycle on the next six digit group and then add the results. Repeat the algorithm until the result is a small number. The original number is divisible by seven if and only if the number obtained using this algorithm is divisible by seven. This method is especially suitable for large numbers.
Example 1:
The number to be tested is 157514.
First we separate the number into three digit pairs: 15, 75 and 14.
Then we apply the algorithm: 1 × 15 − 3 × 75 + 2 × 14 = 182
Because the resulting 182 is less than six digits, we add zero’s to the right side until it is six digits.
Then we apply our algorithm again: 1 × 18 − 3 × 20 + 2 × 0 = −42
The result −42 is divisible by seven, thus the original number 157514 is divisible by seven.
Example 2:
The number to be tested is 15751537186.
+ = −180 + 103 = −77
The result −77 is divisible by seven, thus the original number 15751537186 is divisible by seven.

Divisibility by 13

Remainder Test
13
If you are not comfortable with negative numbers, then use this sequence.
Multiply the right most digit of the number with the left most number in the sequence shown above and the second right most digit to the second left most digit of the number in the sequence. The cycle goes on.
Example: What is the remainder when 321 is divided by 13?

Using the first sequence,
Ans: 1 × 1 + 2 × −3 + 3 × −4 = −17

Remainder = −17 mod 13 = 9
Example: What is the remainder when 1234567 is divided by 13?

Using the second sequence,
Answer: 7 × 1 + 6 × 10 + 5 × 9 + 4 × 12 + 3 × 3 + 2 × 4 + 1 × 1 = 178 mod 13 = 9

Remainder = 9

Beyond 30

Divisibility properties can be determined in two ways, depending on the type of the divisor.

Composite divisors

A number is divisible by a given divisor if it is divisible by the highest power of each of its prime factors. For example, to determine divisibility by 36, check divisibility by 4 and by 9. Note that checking 3 and 12, or 2 and 18, would not be sufficient. A table of prime factors may be useful.
A composite divisor may also have a rule formed using the same procedure as for a prime divisor, given below, with the caveat that the manipulations involved may not introduce any factor which is present in the divisor. For instance, one cannot make a rule for 14 that involves multiplying the equation by 7. This is not an issue for prime divisors because they have no smaller factors.

Prime divisors

The goal is to find an inverse to 10 modulo the prime under consideration and use that as a multiplier to make the divisibility of the original number by that prime depend on the divisibility of the new number by the same prime.
Using 31 as an example, since 10 × = −30 = 1 mod 31, we get the rule for using y − 3x in the table above. Likewise, since 10 × = 280 = 1 mod 31 also, we obtain a complementary rule y + 28x of the same kind - our choice of addition or subtraction being dictated by arithmetic convenience of the smaller value. In fact, this rule for prime divisors besides 2 and 5 is really a rule for divisibility by any integer relatively prime to 10. This is why the last divisibility condition in the tables above and below for any number relatively prime to 10 has the same kind of form.

Notable examples

The following table provides rules for some more notable divisors:
DivisorDivisibility conditionExamples
31Subtract three times the last digit from the rest.837: 83 − 3×7 = 62
32 The number formed by the last five digits is divisible by 32.25,135,520: 35,520=1110×32
32 If the ten thousands digit is even, examine the number formed by the last four digits.41,312: 1312.
32 If the ten thousands digit is odd, examine the number formed by the last four digits plus 16.254,176: 4176+16 = 4192.
32 Add the last two digits to 4 times the rest.1312: + 12 = 64.
33 Add 10 times the last digit to the rest.627: 62 + 10×7 = 132,
13 + 10×2 = 33.
33 Add the digits in blocks of two from right to left.2145: 21 + 45 = 66.
33 It is divisible by 3 and by 11.627: 62 - 7 = 55 and 6 + 2 + 7 = 15 = 3 × 5
35 Number must be divisible by 7 ending in 0 or 5.-
37 Take the digits in blocks of three from right to left and add each block.2,651,272: 2 + 651 + 272 = 925. 925 = 37×25.
37 Subtract 11 times the last digit from the rest.925: 92 − = 37.
39It is divisible by 3 and by 13.351: 35 - 1 = 34 and 3 + 5 + 4 = 12 = 3 × 4
39Add 4 times the last digit to the rest.351: 35 + = 39
41Sum the digits in blocks of five from right to left.72,841,536,727: 7 + 28,415 + 36,727 = 65,149 = 41×1,589.
41Subtract 4 times the last digit from the rest.738: 73 − 8 × 4 = 41.
43Add 13 times the last digit to the rest.36,249: 3624 + 9 × 13 = 3741,
374 + 1 × 13 = 387,
38 + 7 × 13 = 129,
12 + 9 × 13 = 129 = 43 × 3.
43Subtract 3 times the last two digits from the rest.36,249: 362 - 49 × 3 = 215 = 43 × 5.
45The number must be divisible by 9 ending in 0 or 5.2025: Ends in 5 and 2+0+2+5=9.
47Subtract 14 times the last digit from the rest.1,642,979: 164297 − 9 × 14 = 164171,
16417 − 14 = 16403,
1640 − 3 × 14 = 1598,
159 − 8 × 14 = 47.
47Add the last two digits to 6 times the rest.705: 7 × 6 + 5 = 47.
49Add 5 times the last digit to the rest.1,127: 112+=147.
147: 14 + = 49
49Add the last two digits to 2 times the rest.588: 5 × 2 + 88 = 98.
50The last two digits are 00 or 50.134,250: 50.
51Number must be divisible by 3 and 17.459: 4 × 2 - 59 = -51, and 4 + 5 + 9 = 18 = 3 × 6
51Subtract 5 times the last digit from the rest.204: 20-=0
51Subtract the last two digits from 2 times the rest.459: 4 × 2 - 59 = -51.
53Add 16 times the last digit to the rest.3657: 365+=477 = 9 × 53
53Subtract the last two digits from 6 times the rest.5777: 57 × 6 - 77 = 265.
55Number must be divisible by 11 ending in 0 or 5.-
57Number must be divisible by 3 and 19.3591: 359 + 1 × 2 = 361 = 19 × 19, and 3 + 5 + 9 + 1 = 15 = 3 × 5
57Subtract 17 times the last digit from the rest.3591: 359 − 17 = 342,
34 − 2 × 17 = 0.
59Add 6 times the last digit to the rest.295: 29 + 5×6= 59
61Subtract 6 times the last digit from the rest.732: 73-=61
64The number formed by the last six digits must be divisible by 64.2,640,000 is divisible by 64.
65Number must be divisible by 13 ending in 0 or 5.-
67Subtract twice the last two digits from the rest.9112: 91 - 12×2= 67
67Subtract 20 times the last digit from the rest.4489: 448-9×20=448-180=268.
69Number must be divisible by 3 and 23.345: 3 + 4 + 5 = 12 = 3 × 4, and 34 + 5 × 9 = 69 = 3 × 23
69Add 7 times the last digit to the rest.345: 34 + 5×7 = 69
71Subtract 7 times the last digit from the rest.852: 85-=71
73Form the alternating sum of blocks of four from right to left.220,241: 241 - 22 = 219.
73Add 22 times the last digit from the rest.5329: 532 + 22 × 9 = 730,
7 + 22 × 3 = 73.
75Number must be divisible by 3 ending in 00, 25, 50 or 75.-
77Number is divisible by 7 and 11.693: 69 - 3 = 66 = 11 × 6, and 69 - = 63 = 7 × 9
77Form the alternating sum of blocks of three from right to left.76,923: 923 - 76 = 847.
79Add 8 times the last digit to the rest.711: 71 + 1×8= 79
81Subtract 8 times the last digit from the rest.162: 16-=0
83Add 25 times the last digit to the rest.581: 58+=83
83Add the last three digits to four times the rest.38,014: + 14 = 166
85Number must be divisible by 17 ending in 0 or 5.30,855: 3085 - 25 = 3060 = 17×18. And the number ends in 5.
87Subtract 26 times the last digit from the rest.15138: 1513 − 8 × 26 = 1305,
130 − 5 × 26 = 0.
89Add 9 times the last digit to the rest.801: 80 + 1×9 = 89
89Add the last two digits to eleven times the rest.712: 12 + = 89
91Subtract 9 times the last digit from the rest.182: 18 - = 0
91Form the alternating sum of blocks of three from right to left.5,274,997: 5 - 274 + 997 = 728
91Number is divisible by 7 and 13.8281: 828+4 = 832. 83+8=91
828-2=826. 82-12=70.
95Number must be divisible by 19 ending in 0 or 5.51,585: 5158 + 10 = 5168,
516 + 16 = 532,
53 + 4 = 57 = 19×3. And the number ends in 5.
97Subtract 29 times the last digit from the rest.291: 29 - = 0
97Add the last two digits to 3 times the rest.485: + 85 = 97
99Number is divisible by 9 and 11.891: 89 - 1 = 88.
8 + 9 + 1 = 18.
99Add the digits in blocks of two from right to left.144,837: 14 + 48 + 37 = 99.
100Ends with at least two zeros.14100: It has two zeros at the end.
101Form the alternating sum of blocks of two from right to left.40,299: 4 - 2 + 99 = 101.
103Add 31 times the last digit to the rest.585658: 58565 + = 58813. 58813 : 103 = 571
103Subtract the last two digits from 3 times the rest.5356: - 56 = 103
107Subtract 32 times the last digit from the rest.428: 42 - = -214
107Subtract the last two digits from 7 times the rest.1712: 17 × 7 - 12 = 107
109Add 11 times the last digit to the rest.654: 65 + = 109
111Add the digits in blocks of three from right to left.1,370,184: 1 + 370 + 184 = 555
113Add 34 times the last digit from the rest.3842: 384 + 34 × 2 = 452,
45 + 34 × 2 = 113.
121Subtract 12 times the last digit from the rest.847: 84 - 12 × 7 = 0
125The number formed by the last three digits must be divisible by 125.2125 is divisible by 125.
127Subtract 38 times the last digit from the rest.4953: 495 - 38 × 3 = 381,
38 - 38 × 1 = 0.
128The number formed by the last seven digits must be divisible by 128.11,280,000 is divisible by 128.
131Subtract 13 times the last digit from the rest.1834: 183 - 13 × 4 = 131,
13 - 13 = 0.
137Form the alternating sum of blocks of four from right to left.340,171: 171 - 34 = 137.
139Add 14 times the last digit from the rest.1946: 194 + 14 × 6 = 278,
27 + 14 × 8 = 139.
143Form the alternating sum of blocks of three from right to left.1,774,487: 1 - 774 + 487 = -286
143Add 43 times the last digit to the rest.6149: 614 + 43 × 9 = 1001,
100 + 43 = 143.
149Add 15 times the last digit from the rest.2235: 223 + 15 × 5 = 298,
29 + 15 × 8 = 149.
151Subtract 15 times the last digit from the rest.66,893: 6689 - 15 × 3 = 6644 = 151×44.
157Subtract 47 times the last digit from the rest.7536: 753 - 47 × 6 = 471,
47 - 47 = 0.
163Add 49 times the last digit to the rest.26,569: 2656 + 441 = 3097 = 163×19.
167Subtract 5 times the last two digits from the rest.53,774: 537 - 5 × 74 = 167.
173Add 52 times the last digit to the rest.8996: 899 + 52 × 6 = 1211,
121 + 52 = 173.
179Add 18 times the last digit to the rest.3222: 322 + 18 × 2 = 358,
35 + 18 × 8 = 179.
181Subtract 18 times the last digit to the rest.3258: 325 - 18 × 8 = 181,
18 - 18 = 0.
191Subtract 19 times the last digit to the rest.3629: 362 - 19 × 9 = 191,
19 - 19 = 0.
193Add 58 times the last digit to the rest.11194: 1119 + 58 × 4 = 1351,
135 + 58 = 193.
197Subtract 59 times the last digit to the rest.11820: 118 - 59 × 2 = 0.
199Add 20 times the last digit to the rest.3980: 39 + 20 × 8 = 199.
200Last two digits of the number are "00", and the third last digit is an even number.34,400: The third last digit is 4, and the last two digits are zeroes.
211Subtract 21 times the last digit to the rest.44521: 4452 - 21 × 1 = 4431,
443 - 21 × 1 = 422,
42 - 21 × 2 = 0.
223Add 67 times the last digit to the rest.49729: 4972 + 67 × 9 = 5575,
557 + 67 × 5 = 892,
89 + 67 × 2 = 223.
225Last two digits of the number are "00", "25", "50", or "75" and the sum of the digits is a multiple of 9.15,075: 75 is at the end and 1 + 5 + 0 + 7 + 5 = 18 = 2×9.
227Subtract 68 times the last digit to the rest.51756: 5175 - 68 × 6 = 4767,
476 - 68 × 7 = 0.
229Add 23 times the last digit to the rest.52441: 5244 + 23 × 1 = 5267,
526 + 23 × 7 = 687,
68 + 23 × 7 = 229.
233Add 70 times the last digit to the rest.54289: 5428 + 70 × 9 = 6058,
605 + 70 × 8 = 1165,
116 + 70 × 5 = 466,
46 + 70 × 6 = 466 = 233 × 2.
239Take the digits in blocks of seven from right to left and add each block.1,560,000,083: 156 + 83 = 239.
239Add 24 times the last digit to the rest.57121: 5712 + 24 × 1 = 5736,
573 + 24 × 6 = 717,
71 + 24 × 7 = 239.
241Subtract 24 times the last digit to the rest.58081: 5808 - 24 × 1 = 5784,
578 - 24 × 4 = 482,
48 - 24 × 2 = 0.
250The number formed by the last three digits must be divisible by 250.1,327,750 is divisible by 250.
251Subtract 25 times the last digit to the rest.63001: 6300 - 25 × 1 = 6275,
627 - 25 × 5 = 502,
50 - 25 × 2 = 0.
256The number formed by the last eight digits must be divisible by 256.225,600,000 is divisible by 256.
257Subtract 77 times the last digit to the rest.66049: 6604 - 77 × 9 = 5911,
591 - 77 × 1 = 514 = 257 × 2.
263Add 79 times the last digit to the rest.69169: 6916 + 79 × 9 = 7627,
762 + 79 × 7 = 1315,
131 + 79 × 5 = 526,
52 + 79 × 6 = 526 = 263 × 2.
269Add 27 times the last digit to the rest.72361: 7236 + 27 × 1 = 7263,
726 + 27 × 3 = 807,
80 + 27 × 7 = 269.
271Take the digits in blocks of five from right to left and add each block.77,925,613,961: 7 + 79,256 + 13,961 = 93,224 = 271×344.
271Subtract 27 times the last digit from the rest.73441: 7344 - 27 × 1 = 7317,
731 - 27 × 7 = 542,
54 - 27 × 2 = 0.
277Subtract 83 times the last digit from the rest.76729: 7672 - 83 × 9 = 6925,
692 - 83 × 5 = 277.
281Subtract 28 times the last digit from the rest.78961: 7896 - 28 × 1 = 7868,
786 - 28 × 8 = 562,
56 - 28 × 2 = 0.
283Add 85 times the last digit to the rest.80089: 8008 + 85 × 9 = 8773,
877 + 85 × 3 = 1132,
113 + 85 × 2 = 283.
293Add 88 times the last digit to the rest.85849: 8584 + 88 × 9 = 9376,
937 + 88 × 6 = 1465,
146 + 88 × 5 = 586,
58 + 88 × 6 = 586 = 293 × 2.
300Last two digits of the number are "00", and the result of sum the digits must be divisible by 3.3,300: The result of sum the digits is 6, and the last two digits are zeroes.
329Add 33 times the last digit to the rest.9541:954+1×33=954+33=987. 987=3×329.
331Subtract 33 times the last digit from the rest.22177: 2217-231=1986. 1986=6×331.
333Add the digits in blocks of three from right to left.410,922: 410 + 922 = 1,332
369Take the digits in blocks of five from right to left and add each block.50243409: 43409+502=43911. 43911=369×119.
369Add 37 times the last digit to the rest.8487: 848+7×37=848+259=1107.
375The number formed by the last 3 digits must be divisible by 125 and the sum of all digits is a multiple of 3.140,625: 625 = 125×5 and 1 + 4 + 0 + 6 + 2 + 5 = 18 = 6×3.
499Add the last three digits to two times the rest.74,351: 74 × 2 + 351 = 499.
500Ends with 000 or 500.47,500 is divisible by 500.
512The number formed by the last nine digits must be divisible by 512.1,512,000,000 is divisible by 512.
625Ends in 0000, 0625, 1250, 1875, 2500, 3125, 3750, 4375, 5000, 5625, 6250, 6875, 7500, 8125, 8750 or 9375.
Or, the number formed by the last four digits is divisible by 625.
567,886,875: 6875.
983Add the last three digits to seventeen times the rest.64878: 64×17+878=1966. 1966=2×983
987Add the last three digits to thirteen times the rest.30597: 30×13+597=987
987Number must be divisible by 329 with the sum of all digits being divisible by 3.547785: 5+4+7+7+8+5=36. 36=3×12
54778+5×33=54943. 5494+3×33=5593. 559+3×33=658.
658=2×329.
989Add the last three digits to eleven times the rest.21758: 21 × 11 = 231; 758 + 231 = 989
989Number must be divisible by 23 and 43.1978: 197+56=253. 253=11×23
197+104=301. 301=7×43.
993Add the last three digits to seven times the rest.986049: 49+6902=6951. 6951=7×993.
993Number must be divisible by 331 with the sum of all digits being divisible by 3.8937: 8+7=15. 15=3×5.
893-231=662. 662=2×331.
997Add the last three digits to three times the rest.157,526: 157 × 3 + 526= 997
999Add the digits in blocks of three from right to left.235,764: 235 + 764 = 999
1000Ends with at least three zeros.2000 ends with 3 zeros

Generalized divisibility rule

To test for divisibility by D, where D ends in 1, 3, 7, or 9, the following method can be used. Find any multiple of D ending in 9. Then add 1 and divide by 10, denoting the result as m. Then a number N = 10t + q is divisible by D if and only if mq + t is divisible by D. If the number is too large, you can also break it down into several strings with e digits each, satisfying either 10e = 1 or 10e = -1. The sum of the numbers have the same divisibility as the original one.
For example, to determine if 913 = 10×91 + 3 is divisible by 11, find that m = ÷10 = 10. Then mq+t = 10×3+91 = 121; this is divisible by 11, so 913 is also divisible by 11. As another example, to determine if 689 = 10×68 + 9 is divisible by 53, find that m = ÷10 = 16. Then mq+t = 16×9 + 68 = 212, which is divisible by 53 ; so 689 is also divisible by 53.
Alternatively, any number Q = 10c + d is divisible by n = 10a + b, such that gcd = 1, if c + Dd = An for some integer A, where:

The first few terms of the sequence, generated by D are 1, 1, 5, 1, 10, 4, 12, 2,....
The piece wise form of D and the sequence generated by it were first published by Bulgarian mathematician Ivan Stoykov in March 2020.

Proofs

Proof using basic algebra

Many of the simpler rules can be produced using only algebraic manipulation, creating binomials and rearranging them. By writing a number as the sum of each digit times a power of 10 each digit's power can be manipulated individually.
Case where all digits are summed
This method works for divisors that are factors of 10 − 1 = 9.
Using 3 as an example, 3 divides 9 = 10 − 1. That means . The same for all the higher powers of 10: They are all congruent to 1 modulo 3. Since two things that are congruent modulo 3 are either both divisible by 3 or both not, we can interchange values that are congruent modulo 3. So, in a number such as the following, we can replace all the powers of 10 by 1:
which is exactly the sum of the digits.
Case where the alternating sum of digits is used
This method works for divisors that are factors of 10 + 1 = 11.
Using 11 as an example, 11 divides 11 = 10 + 1. That means. For the higher powers of 10, they are congruent to 1 for even powers and congruent to −1 for odd powers:
Like the previous case, we can substitute powers of 10 with congruent values:
which is also the difference between the sum of digits at odd positions and the sum of digits at even positions.
Case where only the last digit matter
This applies to divisors that are a factor of a power of 10. This is because sufficiently high powers of the base are multiples of the divisor, and can be eliminated.
For example, in base 10, the factors of 101 include 2, 5, and 10. Therefore, divisibility by 2, 5, and 10 only depend on whether the last 1 digit is divisible by those divisors. The factors of 102 include 4 and 25, and divisibility by those only depend on the last 2 digits.
Case where only the last digit are removed
Most numbers do not divide 9 or 10 evenly, but do divide a higher power of 10n or 10n − 1. In this case the number is still written in powers of 10, but not fully expanded.
For example, 7 does not divide 9 or 10, but does divide 98, which is close to 100. Thus, proceed from
where in this case a is any integer, and b can range from 0 to 99. Next,
and again expanding
and after eliminating the known multiple of 7, the result is
which is the rule "double the number formed by all but the last two digits, then add the last two digits".
Case where the last digit is multiplied by a factor
The representation of the number may also be multiplied by any number relatively prime to the divisor without changing its divisibility. After observing that 7 divides 21, we can perform the following:
after multiplying by 2, this becomes
and then
Eliminating the 21 gives
and multiplying by −1 gives
Either of the last two rules may be used, depending on which is easier to perform. They correspond to the rule "subtract twice the last digit from the rest".

Proof using modular arithmetic

This section will illustrate the basic method; all the rules can be derived following the same procedure. The following requires a basic grounding in modular arithmetic; for divisibility other than by 2's and 5's the proofs rest on the basic fact that 10 mod m is invertible if 10 and m are relatively prime.
For 2n or 5n:
Only the last n digits need to be checked.
Representing x as
and the divisibility of x is the same as that of z.
For 7:
Since 10 × 5 ≡ 10 × ≡ 1 we can do the following:
Representing x as
so x is divisible by 7 if and only if y − 2z is divisible by 7.