Euclidean Algorithm Calculator
Result
About the Euclidean Algorithm
The Euclidean algorithm is an efficient method for computing the greatest common divisor (GCD) of two integers. It is based on the principle that the GCD of two numbers does not change if the larger number is replaced by its difference with the smaller number.
How it works:
- Start with two numbers a and b (where a ≥ b)
- Divide a by b to get quotient q and remainder r
- Write: a = b × q + r
- Replace a with b and b with r
- Repeat until the remainder is 0
- The last non-zero remainder is the GCD
Example: GCD(48, 18)
48 = 18 × 2 + 12
18 = 12 × 1 + 6
12 = 6 × 2 + 0
Therefore, GCD(48, 18) = 6