One of the most-viewed posts on this blog describes a rule for checking whether a number is divisible by seven.
This post is about another, simpler way to do it.
Take a long number, say
One way to check if it’s divisible by is to subtract multiples of seven until you get down to something small. For example, is a multiple of seven because is. So subtract this number from the original to get . Now subtract to get , etc.
This procedure is fine for small numbers, but you’ll only eliminate one or two digits per subtraction. Here’s a method useful for very long numbers.
First, turn all the ‘s into ‘s, all the ‘s into ‘s, and all the ‘s into ‘s. This is just a simple case of the rule above – subtracting some multiples of . The original number becomes
(If you want, you can take this step further by turning into , etc. I won’t do that here.)
Now break apart each group of three digits separated by parentheses, starting from the right. Put a negative sign on every other group of three digits, then add them all up.
This number is divisible by if and only if the original is.
We need to check for divisibility by . Here, adding and subtracting multiples of is easy. For example, add to get . Now subtract to get . The remainder when you divide by is .
If you want to use this rule, but the number of digits isn’t a multiple of three, you can simple add some zeros on front. For example,
and we get
, so the remainder when you divide by is .
This rule works due to a convenient pattern in the remainders of the powers of ten.
If we start with , the remainder when you divide powers of by is
Each group of three digits, after alternating groups are multiplied by , has the same rule for divisibility by . For example, the remainder when is divided by seven is the same as the remainder for . So we just take those groups of three and add them, simplifying the task greatly.