Divisibility rule
A divisibility rule is a shorthand and useful 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.
To test the divisibility of a number by a power of 2 or a power of 5, one only need to look at the last n digits of that number.
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.
| Divisor | Divisibility condition | Examples |
| 1 | No specific condition. Any integer is divisible by 1. | 2 is divisible by 1. |
| 2 | The last digit is even. | 1,294: 4 is even. |
| 3 | The sum of the digits 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, which is divisible by 3. |
| 3 | Subtract 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. |
| 3 | Subtracting twice the last digit from the rest gives a multiple of 3. | 405: 40 − 5 × 2 = 40 − 10 = 30 = 3 × 10. |
| 4 | The last two digits form a number that is divisible by 4. | 40,832: 32 is divisible by 4. |
| 4 | If 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. |
| 4 | The sum of the ones digit and double the tens digit is divisible by 4. | 40,832: 2 × 3 + 2 = 8, which is divisible by 4. |
| 4 | The last two digits are 00, 04, 08, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92 or 96. | 40,832: the last two digits are 32. |
| 5 | The last digit is 0 or 5. | 495: the last digit is 5. |
| 6 | It is divisible by 2 and by 3. | 1,458: 1 + 4 + 5 + 8 = 18, so it is divisible by 3 and the last digit is even, hence the number is divisible by 6. |
| 6 | Sum the ones digit, 4 times the 10s digit, 4 times the 100s digit, 4 times the 1000s digit, etc. If the result is divisible by 6, so is the original number. | 1,458: + + + 8 = 4 + 16 + 20 + 8 = 48. |
| 7 | Forming an alternating sum of blocks of three from right to left gives a multiple of 7. | 1,369,851: 851 − 369 + 1 = 483 = 7 × 69. |
| 7 | Adding 5 times the last digit to the rest gives a multiple of 7. | 483: 48 + = 63 = 7 × 9. |
| 7 | Subtracting twice the last digit from the rest gives a multiple of 7. | 483: 48 − = 42 = 7 × 6. |
| 7 | Subtracting 9 times the last digit from the rest gives a multiple of 7. | 483: 48 − = 21 = 7 × 3. |
| 7 | Adding 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. |
| 7 | Adding the last two digits to twice the rest gives a multiple of 7. | 483,595: 95 + = 9765: 65 + = 259: 59 + = 63. |
| 7 | Multiply 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. |
| 7 | Compute the remainder of each digit pair when divided by 7. Multiply the rightmost remainder by 1, the next to the left by 2 and the next by 4, repeating the pattern for digit pairs beyond the hundred-thousands place. Adding the results gives a multiple of 7. | 194,536: 204,540: |
| 8 | If the hundreds digit is even, the number formed by the last two digits must be divisible by 8. | 624: 24. |
| 8 | If the hundreds digit is odd, the number obtained by the last two digits must be 4 times an odd number. | 352: 52 = 4 × 13. |
| 8 | Add the last digit to twice the rest. The result must be divisible by 8. | 56: + 6 = 16. |
| 8 | The last three digits are divisible by 8. | 34,152: examine divisibility of just 152: 19 × 8. |
| 8 | The sum of the ones digit, double the tens digit, and four times the hundreds digit is divisible by 8. | 34,152: 4 × 1 + 5 × 2 + 2 = 16. |
| 8 | If the hundreds digit is even, the last two digits must be 00, 08, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88 or 96. | 34,200: 2 is even and the last two digits are 00 |
| 8 | If the hundreds digit is odd, the last two digits must be divisible by 4 but not by 8, ie. 04, 12, 20, 28, 36, 44, 52, 60, 68, 76, 84 or 92. | 34,152: 1 is odd and the last two digits are 52 |
| 9 | The sum of the digits must be divisible by 9. | 2,880: 2 + 8 + 8 + 0 = 18: 1 + 8 = 9. |
| 9 | Subtracting 8 times the last digit from the rest gives a multiple of 9. | 2,880: 288 − 0 × 8 = 288 − 0 = 288 = 9 × 32. |
| 10 | The last digit is 0. | 130: the ones digit is 0. |
| 10 | It is divisible by 2 and by 5. | 130: it is divisible by 2 and by 5. |
| 11 | Form the alternating sum of the digits, or equivalently sum – sum. The result must be divisible by 11, or is 0. | 918,082: 9 − 1 + 8 − 0 + 8 − 2 = 22 = 2 × 11. |
| 11 | Add the digits in blocks of two from right to left. The result must be divisible by 11. | 627: 6 + 27 = 33 = 3 × 11. |
| 11 | Subtract the last digit from the rest. The result must be divisible by 11. | 627: 62 − 7 = 55 = 5 × 11. |
| 11 | Add 10 times the last digit to the rest. The result must be divisible by 11. | 627: 62 + 70 = 132: 13 + 20 = 33 = 3 × 11. |
| 11 | If 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. |
| 11 | If 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: 0 − 4 − 7 = −11 = −1 × 11. |
| 12 | It is divisible by 3 and by 4. | 324: it is divisible by 3 and by 4. |
| 12 | Subtract the last digit from twice the rest. The result must be divisible by 12. | 324: 32 × 2 − 4 = 60 = 5 × 12. |
| 13 | Form 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. |
| 13 | Add 4 times the last digit to the rest. The result must be divisible by 13. | 637: 63 + 7 × 4 = 91, 9 + 1 × 4 = 13. |
| 13 | Subtract the last two digits from four times the rest. The result must be divisible by 13. | 923: 9 × 4 − 23 = 13. |
| 13 | Subtract 9 times the last digit from the rest. The result must be divisible by 13. | 637: 63 − 7 × 9 = 0. |
| 14 | It is divisible by 2 and by 7. | 224: it is divisible by 2 and by 7. |
| 14 | Add the last two digits to twice the rest. The result must be divisible by 14. | 364: 3 × 2 + 64 = 70, 1,764: 17 × 2 + 64 = 98. |
| 15 | It is divisible by 3 and by 5. | 390: it is divisible by 3 and by 5. |
| 16 | If the thousands digit is even, the number formed by the last three digits must be divisible by 16. | 254,176: 176. |
| 16 | If the thousands digit is odd, the number formed by the last three digits must be 8 times an odd number. | 3408: 408 = 8 × 51. |
| 16 | Add the last two digits to four times the rest. The result must be divisible by 16. | 176: 1 × 4 + 76 = 80, 1,168: 11 × 4 + 68 = 112. |
| 16 | The last four digits must be divisible by 16. | 157,648: 7,648 = 478 × 16. |
| 17 | Subtract 5 times the last digit from the rest. | 221: 22 − 1 × 5 = 17. |
| 17 | Add 12 times the last digit to the rest. | 221: 22 + 1 × 12 = 22 + 12 = 34 = 17 × 2. |
| 17 | Subtract the last two digits from two times the rest. | 4,675: 46 × 2 − 75 = 17. |
| 17 | Add twice the last digit to 3 times the rest. Drop trailing zeroes. | 4,675: 467 × 3 + 5 × 2 = 1,411: 141 × 3 + 1 × 2 = 425: 42 × 3 + 5 × 2 = 136: 13 × 3 + 6 × 2 = 51, 238: 23 × 3 + 8 × 2 = 85. |
| 18 | It is divisible by 2 and by 9. | 342: it is divisible by 2 and by 9. |
| 19 | Add twice the last digit to the rest. | 437: 43 + 7 × 2 = 57. |
| 19 | Add 4 times the last two digits to the rest. | 6,935: 69 + 35 × 4 = 209. |
| 20 | It is divisible by 10, and the tens digit is even. | 360: is divisible by 10, and 6 is even. |
| 20 | The last two digits are 00, 20, 40, 60 or 80. | 480: 80 |
| 20 | It is divisible by 4 and by 5. | 480: it is divisible by 4 and by 5. |
| 21 | Subtracting twice the last digit from the rest gives a multiple of 21. | 168: 16 − 8 × 2 = 0. |
| 21 | Summing 19 times the last digit to the rest gives a multiple of 21. | 441: 44 + 1 × 19 = 44 + 19 = 63 = 21 × 3. |
| 21 | It is divisible by 3 and by 7. | 231: it is divisible by 3 and by 7. |
| 22 | It is divisible by 2 and by 11. | 352: it is divisible by 2 and by 11. |
| 23 | Add 7 times the last digit to the rest. | 3,128: 312 + 8 × 7 = 368: 36 + 8 × 7 = 92. |
| 23 | Add 3 times the last two digits to the rest. | 1,725: 17 + 25 × 3 = 92. |
| 23 | Subtract 16 times the last digit from the rest. | 1,012: 101 − 2 × 16 = 101 − 32 = 69 = 23 × 3. |
| 23 | Subtract twice the last three digits from the rest. | 2,068,965: 2,068 − 965 × 2 = 138. |
| 24 | It is divisible by 3 and by 8. | 552: it is divisible by 3 and by 8. |
| 25 | The last two digits are 00, 25, 50 or 75. | 134,250: 50 is divisible by 25. |
| 26 | It is divisible by 2 and by 13. | 156: it is divisible by 2 and by 13. |
| 26 | Subtracting 5 times the last digit from twice the rest of the number gives a multiple of 26. | 1,248 : − = 208 = 26 × 8. |
| 27 | Sum the digits in blocks of three from right to left. | 2,644,272: 2 + 644 + 272 = 918. |
| 27 | Subtract 8 times the last digit from the rest. | 621: 62 − 1 × 8 = 54. |
| 27 | Sum 19 times the last digit from the rest. | 1,026: 102 + 6 x 19 = 102 + 114 = 216 = 27 × 8. |
| 27 | Subtract the last two digits from 8 times the rest. | 6,507: 65 × 8 − 7 = 520 − 7 = 513 = 27 × 19. |
| 28 | It is divisible by 4 and by 7. | 140: it is divisible by 4 and by 7. |
| 29 | Add three times the last digit to the rest. | 348: 34 + 8 × 3 = 58. |
| 29 | Add 9 times the last two digits to the rest. | 5,510: 55 + 10 × 9 = 145 = 5 × 29. |
| 29 | Subtract 26 times the last digit from the rest. | 1,015: 101 − 5 × 26 = 101 − 130 = −29 = 29 × −1 |
| 29 | Subtract twice the last three digits from the rest. | 2,086,956: 2,086 − 956 × 2 = 174. |
| 30 | It is divisible by 3 and by 10. | 270: it is divisible by 3 and by 10. |
| 30 | It is divisible by 2, by 3 and by 5. | 270: it is divisible by 2, by 3 and by 5. |
| 30 | It is divisible by 2 and by 15. | 270: it is divisible by 2 and by 15. |
| 30 | It is divisible by 5 and by 6. | 270: it is divisible by 5 and by 6. |