GCD & LCM Calculator
Find the greatest common divisor and the least common multiple of two integers. The Euclidean algorithm is shown one division at a time, and because everything runs on big integers, numbers of any size work.
Computed
The gcd, the lcm and the full working are shown below.
Greatest common divisorexact
21
Least common multipleexact
1260
Step-by-step solution
- 1
Start
Find gcd(252, 105) with the Euclidean algorithm: divide, keep the remainder, repeat until the remainder is 0.
- 2
Division step 1
Divide 252 by 105 and keep the remainder 42 — it becomes the next divisor.
- 3
Division step 2
Divide 105 by 42 and keep the remainder 21 — it becomes the next divisor.
- 4
Division step 3
21 divides 42 exactly, so the algorithm stops here.
- 5
The gcd is the last non-zero remainder
The remainders shrink until they hit 0; the last divisor, 21, is the gcd.
- 6
From the gcd to the lcm
For any two numbers, gcd · lcm = abs(a · b). Dividing 252 · 105 by the gcd 21 gives the lcm.
- 7
Result
gcd(252, 105) = 21 and lcm(252, 105) = 1260