Math

Euclidean Algorithm Calculator

Find the GCD of two numbers using the Euclidean algorithm.

Parameters Live Compute
Calculated Output
GCD 21
Number of steps 3
Formula: gcd(a, b) = gcd(b, a mod b)
Step-by-Step Breakdown
1. Values used:
2. First number = 252
3. Second number = 105
4.
5. GCD = 21
6. Number of steps = 3
Did this calculator solve your problem today?
Report issue to loopingon.com
Sponsored

The Euclidean algorithm efficiently finds the greatest common divisor by repeated remainders.

The math behind it

Replace (a, b) with (b, a mod b) repeatedly; when the remainder hits 0, the last non-zero value is the GCD.

Worked Example

gcd(252, 105) = 21.

Frequently Asked Questions

Why is it so fast?

Each step roughly shrinks the numbers, so it finishes in very few iterations even for huge inputs.

Advertisement