in reply to (OT) Division-by-seven, division-by-n
You've shown that if you start with a multiple of 7, you can construct 10 other numbers (1 for each y in 0..9) that are also divisible by 7 and which obey cLive's rule. It's not the same as showing that every number obeys cLive's rule.
Using the "|" to mean divides (so 7| x + y means "7 divides x + y") and <=> to mean "if and only if".
(1)7 | x - 2y <=> 7 | 10x - 20y (2)7 | 10x - 20y <=> 7 | 10x + y so 7 | x - 2y <=> 7 | 10x + y
(1) is true because 10 has no factor in common with 7 so multiplying by 10 does not effect divisbility
(2) is true because 21y is divisible by 7 so adding 21y will have no effect on divisibility
This holds for any x and y and every number can be written as 10x+y for some suitable x and y.
The key to finding a rule for divisibility mod N is finding the inverse of 10 mod N. That is, finding I such that
So for example if N is seven the inverse of 10 is 5: 5 * 10 = 50 = 7*7 + 1. So, thinking only in terms of remainder on division by 7,(10 * I) % N == 1
and mod 21, 10 * 19 = 190 = (9*21) +1. So thinking mod 21 we have10x + y = 5 * (10x + y) = 50x + 5y = x + 5y = x - 2y
so 10x + y is divisible by 21 whenever x - 2y is too.10x + y = 19*(10x+y) = 190x +19y = x + 19x = x - 2y
This methods works for non-primes, what's important is that the number doesn't share any factors with 10. ie. it's not divisible by 2 or 5.
Update: fixed a typo I had (N * I) % N = 1 in the definition of inverse. Also fixed a missing / that messed the formatting.
|
|---|