Problem #WSP-000099

Problems Number Theory Divisibility The greatest common divisor (GCD) and the least common multiplier (LCM). Mutually prime numbers

Problem

There is a very, very fast way of computing the greatest common divisor of two positive integers. It was in fact known even to the Greeks two thousand years ago. This procedure is called the Euclidean algorithm, named after Euclid, a famous ancient Greek mathematician.

The algorithm works as follows. Take two positive integers a,b. Let’s say ab.

  1. Calculate the remainder of a when divided by b. Call it r1.

  2. Calculate the remainder of b when divided by r1. Call it r2.

  3. Calculate the remainder of r1 when divided by r2. Call it r3.

  4. Continue to divide the remainder from two steps prior by the remainder from the last step, until...

  5. The remainder rn is divisible by rn+1. The Euclidean algorithm stops now and rn+1 is gcd(a,b).

Show that there is indeed some natural number n such that rn is divisible by rn+1, so that the Euclidean algorithm must stop eventually. Furthermore, show that rn+1 is actually gcd(a,b) (otherwise it is all in vain!).