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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

58 CHAPTER 4. THE EUCLIDEAN ALGORITHM<br />

The individual computations are not difficult, but the continual swapping <strong>of</strong><br />

gcd entries, as well as the rewriting <strong>of</strong> “gcd” is a bit much. In addition while<br />

we have kept the remainder information, we have lost the quotients that we will<br />

soon need. So we are going to introduce a more compact way <strong>of</strong> presenting this<br />

computation, perhaps due to [Glasby].<br />

To see how this is built, consider gcd(69, 27) = gcd(27, 69%27). The remainder<br />

69%27 is 15, and the quotient <strong>of</strong> 69 ÷ 27 is 2. So we write<br />

q<br />

r 69<br />

2<br />

27 15<br />

where q and r remind us which line contains the quotient and which the remainder.<br />

Similarly, for gcd(27, 15) = gcd(15, 27%15) we write<br />

q<br />

r 17<br />

1<br />

15 12<br />

since the quotient <strong>of</strong> 27 ÷ 15 is 1 and the remainder is 12.<br />

The advantage <strong>of</strong> this representation is that<br />

,<br />

q<br />

r 69<br />

2<br />

27 15<br />

and<br />

q<br />

r 17<br />

1<br />

15 12<br />

may be combined as<br />

q<br />

r 69<br />

Adding the 12 ÷ 3 results then gives<br />

2<br />

27<br />

1<br />

15 12<br />

.<br />

q<br />

r 69<br />

2<br />

27<br />

1<br />

15<br />

1<br />

12<br />

4<br />

3 0<br />

.<br />

Examples:<br />

(1) Compute gcd(15, 85).<br />

For this first example we work one division step at a time and write in<br />

bold the numbers added at each step.<br />

Enter the two numbers, larger one first:<br />

q<br />

r 85 15<br />

from 85 ÷ 15:<br />

from 15 ÷ 10:<br />

from 10 ÷ 5:<br />

q<br />

r 85<br />

q<br />

r 85<br />

q<br />

r 85<br />

5<br />

15<br />

5<br />

15<br />

1<br />

10<br />

5<br />

15 10<br />

1<br />

10 5<br />

2<br />

5 0<br />

The gcd is the final non-zero remainder. So gcd(15, 85) = 5.

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

Saved successfully!

Ooh no, something went wrong!