trying to better understand modulo calculation

eg given the following number modulo 55

74627282173621618272362 % 55 = 47

why does splitting the number; calculate first part modulo 55; add result in front of the second part and use modulo 55 again; yield the same result again?

using the example above:

746272821736 % 55 = 46

'46' + '21618272362' = 4621618272362

4621618272362 % 55 = 47

same result if you calculate the number digit by digit using the way described above

7 % 55 = 7

'7' + '4' = 74 % 55 = 19

'19' + '6' = 196 % 55 = 31

'31' + '2' = 312 % 55 = 37

....

result = 47

could someone clarify WHY?


It comes so because the property which holds here is basic and is

Dividend = Divisor * Quotient + Remainder

This is all because of long-division method.

I am working out a question for you.

Ex :- 123456789 % 4

Here,

55 ) 123456789 ( 22...
    -110_______
      13456789   // here, you'd have replaced it as 13456789 which indeed comes from long-division
     -110_____
       2456789   // here, you'd have replaced it as 2456789 which indeed comes from long-division

It is so because the remainders are itself put down in the long-division method exactly below the number so that the number gets reduced and the number in next stage is substituted by remainder left appended next by the rest-undivided number.

What you're quoting is none-different from this case.

So,you see that once you find a number which yields remainder 0 in between, you can drop the digits upto which your remainder is 0. And,then fresh start with the further digits assuming it as the given number. This is surely a formula-type thing.

But,your hypothesis was correct and is what we use in the long-division method of formulating the remainders/modulo!

链接地址: http://www.djcxy.com/p/58294.html

上一篇: python如何计算这个模数?

下一篇: 试图更好地理解模计算