On this page
Most divisibility rules are one glance: even last digit for 2, digit sum for 3 and 9, last digit 0 or 5 for 5. Seven has no glance rule, so most students fall back on long division. There is a short test you can repeat in your head, with a three-line proof.
How does the subtract-twice-the-last-digit test for 7 work?
Wolfram MathWorld gives the test like this: split off the units digit, subtract twice that digit from the number formed by the remaining digits, and repeat; the original number is divisible by 7 if and only if the number at the last step is.
Cross out the last digit of the number.
Double the digit you crossed out.
Subtract that from what is left.
Repeat on the answer until you reach a number you can judge at sight, such as 0, 7, 14, 21 or 70.
The Wikipedia list of divisibility rules uses 483 as its example: 48 − (3 × 2) = 42, which is 7 × 6, so 483 is divisible by 7.
A four-digit warm-up: for 2,401, compute 240 − 2 = 238, then 23 − 16 = 7. So 2,401 is a multiple of 7 (it is 7 × 7 × 7 × 7).
Worked example: is 864,199 divisible by 7?
Each line removes one digit, so a six-digit number takes at most five rounds.
864,199: last digit 9, double is 18. 86,419 − 18 = 86,401.
86,401: last digit 1, double is 2. 8,640 − 2 = 8,638.
8,638: last digit 8, double is 16. 863 − 16 = 847.
847: last digit 7, double is 14. 84 − 14 = 70.
70 is 7 × 10, so you can stop.
So 864,199 is divisible by 7. Long division agrees: 864,199 = 7 × 123,457. Every number in the chain is a multiple of 7 too (847 = 7 × 121, for instance).
Now try the next number, 864,200. The chain runs 86,420, then 8,642, then 864 − 4 = 860, then 86, then 8 − 12 = −4. The result −4 is not a multiple of 7, so 864,200 is not divisible by 7.
Why does the rule for 7 work?
Write any whole number as n = 10a + b, where b is the last digit and a is everything before it. The test replaces n with a − 2b. Multiply that by 10:
10(a − 2b) = 10a − 20b = n − 21b
So n = 10(a − 2b) + 21b. Since 21b = 7 × 3b, it is always a multiple of 7. That means n is a multiple of 7 exactly when 10(a − 2b) is. And because 7 is prime and does not divide 10, 10(a − 2b) is a multiple of 7 exactly when a − 2b is. That is the whole proof; the Wikipedia page linked above gives the same argument in modular notation.
Two side benefits fall out of the same line. Because 21 is also 3 × 7, the identical test works for 3 (51 gives 5 − 2 = 3). And Wikipedia lists a twin rule, adding 5 times the last digit to the rest, which works because 10(a + 5b) = n + 49b.
Does the test tell you the remainder when dividing by 7?
No, and this is the trap. 864,200 is one more than a multiple of 7, so its remainder is 1, yet its chain ended at −4, which leaves remainder 3. Each round multiplies the remainder by 5 (working mod 7), so after several rounds the final number keeps the yes-or-no answer but scrambles the remainder.
If a question asks for the remainder, use long division or the methods in our guide to finding remainders of large powers with modular arithmetic. If you want to check a multiplication rather than a divisibility, casting out nines is quicker.
When should you use the test for 7?
Simplifying fractions: before cancelling, check whether 7 divides both the numerator and denominator.
Factorising: after ruling out 2, 3 and 5, run the test before trying 11 and 13.
Counting problems: when you need to check a few candidates by hand, as in counting numbers not divisible by 2, 3 or 5.
Skip it for remainders, and for numbers under 100, where knowing the 7 times table is faster.
If you keep getting a different answer from your textbook, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer, so you can see the line where yours went off. To review why primes and divisibility behave this way, the mathematics section of the Fermi Concept Library gives each concept its own lesson.



