How can you tell whether a number is divisible by 7? Almost everyone knows tricks to test divisibility by 2, 3, 5, or 9. Testing divisibility by 4, 6, 8, or 11 is a bit trickier. But not many people have ever seen a trick for testing divisibility by 7.

How to test: Remove the last digit from the number, double it, and subtract it from the first part of the number. Do this repeatedly until you get something you recognize as being divisible by 7 or not.

Example: Lets test for 826. Split 826 into 82 and 6. Subtract 12(6*2) from 82 to get 70. Since 70 is divisible by 7, so is 826.

Another Example: For 8632. Split 8632 into 863 and 2. Subtract 4(2*2) from 863 to get 859.

Now split 859 into 85 and 9. Subtract 18(9*2) from 85 to get 67, which isn’t divisible by 7. Hence, we conclude that 8632 isn’t divisible by 7.

Why does this work? Let b be the last digit of a number n and let a be the number we get when we split off b. That says n = 10a + b. Now n is divisible by 7 if and only if n – 21b is divisible by 7. But

n – 21b = 10a + b - 21b = 10(a – 2b)

Above is divisible by 7 if and only if a – 2b is divisible by 7.

Similarly, we can find divisibility by 13, 17, 19 etc.

Divisibility by 13: Add four times the last digit to the remaining leading truncated number to make it (n + 39b) = 10(a + 4b)

Divisibility by 17: Subtract five times the last digit from the remaining leading truncated number to make it (n - 51b) = 10(a - 5b)

Divisibility by 19: Add two times the last digit to the remaining leading truncated number to make it (n + 19b) = 10(a + 2b)

Test above divisibility yourselves with examples.

PS: Thanks John D. Cook for this trick.