All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Threes and sevens (Posted on 2006-10-25) Difficulty: 3 of 5
You can decide whether a number is divisible by 3 by forming its cross sum, that is the sum of all its decimal digits: It is divisible by three exactly if its cross sum is. Similarly, a three-digit number is divisible by seven if (and only if) the sum of twice its most significant digit plus three times its middle digit plus its least significant digit is divisible by seven.

Can you find a similar scheme for checking divisibility by 33 and 37, for numbers with an arbitrary number of digits?

No Solution Yet Submitted by vswitchs    
Rating: 2.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Generally speaking ... | Comment 4 of 7 |
Let N = u0 + u1x10 + u2x10^2 + u3x10^3 + ... + ukx10^k

Then N is evenly divisible by m if and only if

 u0 + u1x(10 mod m) + u2x(10^2 mod m) + u3x(10^3 mod m) + ... + ukx(10^k mod m) is divisible by m.

For instance, if m = 33, then
u0 + u1x(10 mod m) + u2x(10^2 mod m) + u3x(10^3 mod m) + ... + ukx(10^k mod m)  = u0 +10*u1 + u2 + 10_u3 + ..., as previously given.

If m = 11,  then we can also evaluate u0 +10*u1 + u2 + 10*u3  etc,
but it is computationally easier to subtract 11*u1 + 11*u3 + 11*u5 etc, giving u0 - u1 + u2 - u3 + u4  ... as the vswitchs "cross sum"

  Posted by Steve Herman on 2006-10-25 12:15:50
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information