06.01.2015 Views

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.1. THE REMAINDER OPERATOR 37<br />

As a bit <strong>of</strong> a time saver, notice that after doing the division you do not need<br />

to clear the screen (on your calculator) before punching in the decimal, but<br />

can instead subtract <strong>of</strong>f the quotient. For example, redoing 888%31, we have<br />

888 ÷ 31 = 28.6451. Subtract 28 to leave .6451 which we then multiply by 31. 3<br />

Examples: Compute the following remainders.<br />

(1) 424%26 =<br />

424/26 = 16.3077. Subtracting 16 leaves .3077. Answer is .3077 × 26 = 8.<br />

(2) 58%7 =<br />

58/7 = 8.2857 → .2857 × 7 = 2. Answer: 2.<br />

(3) 101%11 =<br />

(4) 2045%21 =<br />

(5) 48924%30 = 4<br />

⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄<br />

What about −29%12 Following our procedure (divide by 12, discard the<br />

quotient, multiply by 12) gives −5. Since the goal was a small positive number,<br />

we now simply add 12. So −29%12 = 7. In the shortcut notation, −29/12 =<br />

−2.4167 → −2.4167 + 2 = −.4167 → −.4167 × 12 = −5 → −5 + 12 = 7.<br />

Examples: Compute the following remainders.<br />

(1) −89%23 =<br />

−89/23 = −3.869 → −3.869 + 3 = −.869 → −.869 × 23 = −20 →<br />

−20 + 23 = 3. Ans: 3<br />

(2) −134%17 =<br />

(3) −748%73 = 5<br />

⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄<br />

Let’s summarize our work.<br />

3 The presence <strong>of</strong> division, and the comment about rounding, might make one concerned<br />

about the validity <strong>of</strong> this algorithm. Indeed, calculators only hold so many digits, so error is<br />

possible, especially when a is very large. These are valid concerns, but ones we will not worry<br />

about.<br />

4 (4) 12, (5) 2, (6) 8, (7) 24<br />

5 (2) 2, (3) 55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!