Britannica
Sources used in this answer
How does the Euclidean algorithm find the greatest common divisor of two numbers?
Created from Britannica articles
using AI.
AI can make mistakes, so verify using Britannica articles.
Euclidean geometry
This diagram depicts three basic theorems that triangles are congruentâthat is, they are of equal shape and sizeâif: (1) two sides and the included angle are equal, designated SAS; (2) two angles and the included side are equal, designated ASA; or (3) all three sides are equal, designated SSS.
The Euclidean algorithm is a procedure for finding the greatest common divisor (GCD) of two numbers. While the term "Euclidean" is most famously associated with Euclidean geometryâthe study of plane and solid figures based on axioms and theoremsâthe algorithm itself is an arithmetic method described by Euclid in his Elements.12
The algorithm functions through successive division and the calculation of remainders:
- Divide the first number by the second and note the remainder.
- Replace the first number with the second, and the second number with the remainder obtained in the previous step.
- Repeat this process until the remainder is 0.
- The last nonzero remainder is the GCD.1
For example, to find the GCD of 56 and 12:
1.
2.
3.
Since the remainder is now 0, the last nonzero remainder, 4, is the GCD.1