Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-oxford/2017/prelims/mathematics-iv/7/a/i/solution

The euclidean algorithm computes the greatest common divisor of two integers by repeated division with remainder. Start with , , interchanging them if necessary, and repeatedly write
until a zero remainder occurs. The positive remainders strictly decrease, so the process terminates. At each step the common divisors of are exactly the common divisors of , because . Hence
If one input is zero, the answer is the absolute value of the other; the usual convention sets . Back-substitution also expresses the greatest common divisor as an integer linear combination of the inputs, as in Bézout's identity.

New to topics? Read the docs here!