22 September 2016

Finding remainders with the help of a calculator

Most calculators will not give you remainders directly. But we can use a form of the division algorithm together with the calculator to find a remainder when the long division would be too lengthy or tedious.

To recall, the division algorithms says that for any natural numbers m and n, there are whole numbers q and r (with r<n) such that
     m = n*q + r
Solving this for r, we can rewrite it as
    r = m - n*q
In this, m is the dividend, n is the divisor (or modulus), and q is the whole-number quotient when the dividend is divided by the modulus. We will use the calculator to find q and then to find r by the formula above.

The example I worked in class was finding 884736 mod 7.
Divide 884736 by 7 on the calculator. Here the dividend m is 884736 and the divisor n is 7. The calculated quotient will contain a decimal part: 126390.857142857...
So we just ignore everything after the decimal point to get q = 126390
Note: do not round: just ignore everything after the decimal point. (This is called "truncating".)

Now we can find the remainder r:
r = 884736 - 7*126390 = 884736 - 884730 = 6



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.