Theorem
Divisibility by , and from alternating three-digit groups
Arithmetic • Number System • Divisibility
Formula
Split a whole number into groups of three digits starting from the units end, . Because and , we have modulo each of , and , so the number leaves the same remainder as on division by any of them; in particular it is divisible by , or exactly when that alternating sum is.
How to use it
- 1Group from the right, as with thousands separators; the leftmost group may have fewer than three digits.
- 2Give the units group a sign and alternate leftwards, then reduce the small result by ordinary division.
- 3An unknown digit inside a group stays as a term such as or in that group's value, so the condition collapses to one small linear congruence in .
- 4The same alternating sum settles , and at once, and hence , , and .
Worked example
Is divisible by ? Is it divisible by ?
Step-by-step
- 1Groups from the right: , , .
Why: Three digits at a time, starting from the units digit.
- 2
Why: Alternate the signs, starting with on the units group.
- 3, but .
Why: The alternating sum carries the same remainder as the number, so test it instead.
Answer
Divisible by (), but not by .
Watch out
Grouping from the left instead of the right gives a different sum that tests nothing. The test is for , and only, the factors of ; it says nothing about or , which use the plain digit sum. A negative alternating sum is fine: only whether it is a multiple, or its remainder, matters.
Builds on
Also known as
divisibility by 13, divisibility by 7, 1001 rule, 7 x 11 x 13 = 1001, alternating sum of three-digit groups, test for 13, divisibility rule for 7 11 13, periods of three digits