Euclid's algorithm

(algorithm)

Definition: An algorithm to compute the greatest common divisor of two integers. It is Euclid(a,b){if (b=0) then return a; else return Euclid(b, a mod b);}. The run time complexity is O(( log a)( log b)) bit operations.

Also known as Euclidean algorithm.

See also binary GCD algorithm, extended Euclid's algorithm, Ferguson-Forcade algorithm.

Note: After [CLR90, page 810].

Author: PEB

Implementation

Worst-case behavior annotated for real time (WOOP/ADA).
Go to the Dictionary of Algorithms and Data Structures home page.

If you have suggestions, corrections, or comments, please get in touch with Paul E. Black  (paul.black@nist.gov).

Entry modified Thu Nov 8 10:41:07 2001.
HTML page formatted Thu Jan 31 13:48:24 2002.

This page's original URL is http://www.nist.gov/dads/HTML/euclidalgo.html