one plus one two

· number theory

A divisibility test for 7 that is actually usable

Tests for 2, 3, 5, 9 and 11 are well known. The one for 7 is usually skipped because the textbook version is awkward. Here is a version that is easy to do in your head.

Split off the last digit, double it, and subtract it from the rest. Repeat until the number is small.

  3,976 → 397 − 12 = 385
    385 →  38 − 10 =  28 = 4 × 7   ✓  divisible
  1,234 → 123 −  8 = 115
    115 →  11 − 10 =   1           ✗  not divisible

Why it works

Write the number as 10a + b. Then 10a + b ≡ 0 (mod 7) exactly when a − 2b ≡ 0 (mod 7), because multiplying a − 2b by 10 gives 10a − 20b = (10a + b) − 21b, and 21 is a multiple of 7. Since 10 and 7 share no factors, nothing is lost in the step.

The same trick works for 13 if you add four times the last digit instead of subtracting twice.