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
Calculate the remainder of
Calculate the remainder of
Calculate the remainder of
Continue to divide the remainder from two steps prior by the remainder from the last step, until...
The remainder
Show that there is indeed some natural number