lotus

previous page: 90 arithmetic/tests.for.divisibility/nine.p
  
page up: Puzzles FAQ
  
next page: 92 arithmetic/tests.for.divisibility/three.p

91 arithmetic/tests.for.divisibility/seven.p




Description

This article is from the Puzzles FAQ, by Chris Cole chris@questrel.questrel.com and Matthew Daly mwdaly@pobox.com with numerous contributions by others.

91 arithmetic/tests.for.divisibility/seven.p


What is the test to see if a number is divisible by seven?

arithmetic/tests.for.divisibility/seven.s

Take the last digit (n mod 10) and double it.
Take the rest of the digits (n div 10) and subtract the doubled last
digit from it.
The resulting number is divisible by 7 iff the original number
is divisible by 7.

Example:  Take 53445
          Subtract (53445 mod 10) * 2 from (53445 div 10)
                           -  5  * 2   +   5344
                            = 5334
	  533 - 2 * 4 = 525
	  52 - 5 * 2 = 42 which is divisible by 7
          so 53445 is divisible by 7.

 

Continue to:













TOP
previous page: 90 arithmetic/tests.for.divisibility/nine.p
  
page up: Puzzles FAQ
  
next page: 92 arithmetic/tests.for.divisibility/three.p