Euclidean algorithm
Original Euclidean algorithm.