It's easy to tell if a given whole number is divisible by 2. Just check whether the last digit is even. There are also simple rules to determine whether a number is divisible by 3, 4, 5, 6, 8, 9, or 10. The exception is 7.
The known rules for testing for divisibility by 7 are amazingly cumbersome.
Here's one such rule. To find out if a number is divisible by 7, double the last digit, then subtract it from the remaining digits of the number. If you get an answer divisible by 7, then the original number is divisible by 7. If you don't know whether the new number is divisible by 7, you apply the rule again.
For example, to check whether 616 is divisible by 7, double the last digit (6 x 2 = 12), then subtract the answer from the remaining digits (61 12 = 49). Because 49 is divisible by 7, so is 616.
The method works quite well for small numbers. For larger numbers, the rule is sufficiently complicated that it takes nearly as much effort to check for divisibility as it would be to perform the division operation itself.
Over the years, people have come up with dozens of algorithms for divisibility by 7. The latest entry comes from Gustavo Gerald Toja Frachia of São Paulo University.
Here's an example of how Toja's ingenious method works.
Toja describes his method and explains why it works at http://www.divisibilitybyseven.mat.br/. He argues that his algorithm is remarkably fast and efficient for determining if large numbers are divisible by 7.
Alexander Bogolmolny recently extended Toja's algorithm to divisibility by 11 and 13 (see http://www.cut-the-knot.org/blue/div7-11-13.shtml), and Toja added a way of determining the remainder when a number isn't divisible by 7.
Interestingly, Toja's method starts off in much the same way as an algorithm developed by L. Vosburgh Lyons, a New York neuropsychiatrist. This method was first disclosed by Martin Gardner in a 1962 Scientific American article.
Here's the example that Gardner uses to demonstrate the Lyons test.
It still seems like a lot of work! There's just something about 7 that brings in all sorts of complexities.
At a time when calculators and computers are ubiquitous, it's not clear how useful it is to know algorithms for divisibility. Playing with numbers, however, has an enduring appeal, especially when it comes to mystical "7."
Copyright © 2005 by Ivars Peterson
References:
Gustavo Toja describes his method for determining if a number is divisible by 7 at http://www.divisibilitybyseven.mat.br/.
Alexander Bogomolny's extension of Toja's method to divisibility by 11 and 13 can be found at http://www.cut-the-knot.org/blue/div7-11-13.shtml.
Gardner, M. 1969. Tests of divisibility. In The Unexpected Hanging and Other Mathematical Diversions. New York: Simon and Schuster. See Martin Gardner's Mathematical Games.
Peterson, I. 2002. Testing for divisibility. MAA Online (Aug. 19).
For additional information about divisibility by 7, see http://www.math.hmc.edu/funfacts/ffiles/10005.5.shtml. Other divisibility rules can be found at http://mathforum.org/k12/mathtips/division.tips.html, http://www.cut-the-knot.org/blue/FurtherDivisibility.shtm, and http://argyll.epsb.ca/jreed/math7/strand1/1104.htm.