Greatest common divisors and Euclid’s algorithm [01DZ]

Picking up from last time, we return to our idea for a recursive calculation of greatest common divisors.

The algorithm suggested by the above is called Euclid’s Algorithm, which we write out in OCaml code below.

We will shortly now show the correctness of Euclid’s algorithm; to that end, we first recall the definition of greatest common divisors:

Context

Lecture 8: Euclid’s Algorithm, properties of gcds, Euclid’s Theorem, extended Euclid’s algorithm [01DY]

Related

Definition. Greatest common divisor [01E3]

Algorithm. Euclid’s algorithm for calculating the gcd [01E0]

Idea. Recursive calculation of greatest common divisors [01DX]