euclids gcd Algorithm

The original algorithm was described only for natural numbers and geometric lengths (real numbers), but the algorithm was generalized in the 19th century to other types of numbers, such as Gaussian integers and polynomials of one variable. With this improvement, the algorithm never necessitates more steps than five times the number of digits (base 10) of the smaller integer.

euclids gcd source code, pseudocode and analysis