in reply to (OT) Division-by-seven, division-by-n

What a lot of work japhy! Here's a short version.
Let N be an integer that is divisible by 7 Let "xy" be a number . Eg, for 203, x=20, y=3 for 1984, x=198 y=4 If this number is divisible by seven, then: 10x + y = N => 7x + 3x + y = N => 3x + y = N => 9x + 3y = N So 10x + y = N 9x + 3y = N => x - 2y = N

ie, if "xy" is divisible by 7, then x-2y is also divisible by 7.

And, if you can be bothered, it can easily be shown that the reverse is true also, so we have:

"xy" % 7 = 0 <=> (x - 2y) % 7 = 0

cLive ;-)