Euclid's Algorithm Calculator
Use Euclid's algorithm to find the GCD of two numbers. Step-by-step Euclidean algorithm.
and
Try:
How to Use
- Enter two positive integers
- Click "Run Euclid's Algorithm"
- View the step-by-step solution
- See the GCD and LCM results
What is Euclid's Algorithm Calculator?
Euclid's algorithm is an efficient method for finding the Greatest Common Divisor (GCD) of two numbers. Dating back to ancient Greece, it works by repeatedly dividing and taking remainders until the remainder is zero.
Formula
Euclid's Algorithm:
GCD(a, b) = GCD(b, a mod b)
Continue until remainder = 0
The last non-zero remainder is the GCD
Examples
- GCD(48, 18): 48 = 2×18 + 12, 18 = 1×12 + 6, 12 = 2×6 + 0 → GCD = 6
- GCD(252, 105): 252 = 2×105 + 42, 105 = 2×42 + 21, 42 = 2×21 + 0 → GCD = 21
FAQ
Why is Euclid's algorithm efficient?
The algorithm is very efficient because each step reduces the numbers significantly. It can find the GCD of large numbers in relatively few steps, making it much faster than listing all factors.
What's the relationship between GCD and LCM?
For any two numbers a and b: GCD(a,b) × LCM(a,b) = a × b. This means once you know the GCD, you can easily calculate the LCM.
Can Euclid's algorithm work with more than two numbers?
Yes! Find the GCD of the first two numbers, then find the GCD of that result with the third number, and so on. GCD(a,b,c) = GCD(GCD(a,b), c).