Euclidean algorithm
This simplifies the Euclidean algorithm to the form