This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Euclidean algorithm and greatest common divisor So you have two positive integers, a and b , and you want to find d = gcd ( a, b ) and s, t such that as + bt = d . Well, here’s how you do it. Suppose a ≥ b . Then, by the division algorithm, there are unique q 1 , r 1 such that a = q 1 b + r 1 . Well, unless r 1 is equal to 0, we aren’t done. Remember the division algorithm, we’re guaranteed that r 1 < b . So we can do the division algorithm on those two, so that b = q 2 r 1 + r 2 . Now we are guaranteed that r 2 < r 1 . If r 2 = 0, we’re done, and the gcd ( a, b ) = r 1 . Otherwise, we keep doing this (getting q i and r i until, at long last, r i = 0. Then the gcd ( a, b ) = r i 1 , the previous remainder. But that’s only half the battle. We need to find s, t such that as + bt = d . So here’s what we do. Notice that the remainder in each equation is used in the next line as a divisor. So what we can do is solve each equation for r i . So, from the first equation, we get that....
View
Full Document
 Fall '08
 Miller
 Math, Division, Remainder, Integers, Greatest common divisor, Euclidean algorithm, Ri

Click to edit the document details