Britannica
Sources used in this answer
How does the Euclidean algorithm find a greatest common divisor?
Created from Britannica articles
using AI.
AI can make mistakes, so verify using Britannica articles.
Euclid
Euclid, coloured woodcut, 1584. His Elements, a treatise on geometry and mathematics, is one of the most influential books ever written.
The Euclidean algorithm is a computationally efficient procedure for finding the greatest common divisor (GCD) of two numbers, as described by the Greek mathematician Euclid in his Elements.1
The method relies on a process of successive division and calculation of remainders:
- Divide the first number by the second and note the remainder.
- Replace the first number with the previous divisor and the second number with the previous remainder.
- Repeat this division process until the remainder is 0.
- The last nonzero remainder obtained before reaching 0 is the greatest common divisor.1
For example, to find the GCD of 56 and 12:
1.
2.
3.
Since the final remainder is 0, the last nonzero remainder, 4, is the greatest common divisor.1