I've just bumped into an interesting method to figure out if p is congruent to 0 modulo 7.
So let's take a 3-digit number 378, e.g. let's make a sum of the number in the first two digits and 5 multiplied by the last digit: 37 + 5*8 = 77, 7+7*5 = 42, 4+2*5=14, 1+4*5=21, 2+5*1=7. If the result is divisible by 7, then the original number is also divisible by seven. It's cool, right?
What are the situations with larger numbers?
131232158 => I always use some congruency rule:
if a congruent to b mod P, and X congruent to Y mod P
then a +X congruent to b+Y mod P
So, my trick is to decrease the original number with a multiplier of the divisor.
131232158 mod 7 =
131232158 - 70000000 mod 7=
61232158 - 56000000 mod 7 =
5232158 -490000 mod 7 =
332158- 280000 mod 7 =
52158 - 49000 mod 7 =
3158-2800 mod 7=
358-350 mod 7 =
8 mod 7 = 1.
You might find this procedure a littebit hard becuase of the substractions, do not be scared at all! Notice that, those all substractions are focusing on the first two digits of the number.
131232158 take the 13, 13-7 = 6 + the rest of the digits
61232158 take the 61, 61-56 =5 + the rest of the digits
5232158 take the 52, 52-49=3 + rest of the the digits
332158 take the 33, 33-28=5 ....
52158 take the 52, 52 -49 = 3 ...
3158 take the 31, 31-28 = 3 ...
358 take the 35, 35-35 = 0
8 take the 8, 8-7 =1
1
all of the numbers above are congruent 1 modulo 7.
Comments