GCD & LCM Calculator
Calculate Greatest Common Divisor and Least Common Multiple
Greatest Common Divisor (GCD)
6
The largest number that divides all given numbers
Least Common Multiple (LCM)
72
The smallest number divisible by all given numbers
Verification
GCD divides all numbers:
12 ÷ 6 = 2
18 ÷ 6 = 3
24 ÷ 6 = 4
LCM is divisible by all:
72 ÷ 12 = 6
72 ÷ 18 = 4
72 ÷ 24 = 3
Property: GCD × LCM = Product of numbers (for two numbers)
Prime Factorization Method
12 =2^2 x 3
18 =2 x 3^2
24 =2^3 x 3
GCD = Minimum powers
Take the lowest power of each common prime factor
LCM = Maximum powers
Take the highest power of each prime factor
Euclidean Algorithm (for 12 and 18)
| Step | Division | Quotient | Remainder |
|---|---|---|---|
| 1 | 12 ÷ 18 | 0 | 12 |
| 2 | 18 ÷ 12 | 1 | 6 |
| 3 | 12 ÷ 6 | 2 | 0 |
When remainder = 0, the divisor (6) is the GCD
Example Inputs
Formulas & Properties
GCD Properties
- GCD(a, b) = GCD(b, a % b)
- GCD(a, 0) = a
- GCD(a, 1) = 1
- GCD(a, a) = a
LCM Properties
- LCM(a, b) = |a × b| / GCD(a, b)
- LCM(a, 1) = a
- LCM(a, a) = a
- LCM is always ≥ max(a, b)