Thursday, 23 March 2017

modular arithmetic - Why is 145mod63=44?



When I enter 145mod63 into google and some other calculators, I get 44. But when I try to calculate it by hand I get that 145/63 is 2 with a remainder of 19. This makes sense to me, because 63(2)=126, and 12619=145.




So why do the calculators give that the answer is 44?


Answer



I think you have to start with the more basic question, "What does mod mean?"



When we say "(mod63)" what we really mean is: Pretend that the "number line" is bent around in a circle so that when counting up, after you hit 62 you return to 0. On such a "number circle", the numbers 5,68,131,194, are all equal to each other. And you can count downwards, too: 68,5,58,121, are also all equal.



It's common to interpret a(mod63) to mean "Find the number between 0 and 62 that is equal to a, mod 63." You can always find such a number by repeatedly adding or subtracting 63 to your given number until you get it into the desired range.



In this case, 145=82=19=44=107=. The only result that lies between 0 and 62 is 44.




Note, though, that you are not wrong in thinking that 145(mod63)=19. When working mod 63, the numbers 19 and 44 are identical.


No comments:

Post a Comment

real analysis - How to find limhrightarrow0fracsin(ha)h

How to find limh0sin(ha)h without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...