LCM & GCD Calculator
Find GCD and LCM with prime factorization
GCD & LCM
—
Related Calculators
Frequently Asked Questions
What is GCD (Greatest Common Divisor)?
The GCD (also called HCF — Highest Common Factor) is the largest number that divides all given numbers evenly. GCD(12, 18) = 6 because 6 is the largest number that divides both 12 and 18. Use the Euclidean algorithm: GCD(18,12) = GCD(12,6) = GCD(6,0) = 6.
What is LCM (Least Common Multiple)?
The LCM is the smallest positive integer that is divisible by all given numbers. LCM(4, 6) = 12 because 12 is the smallest number that both 4 and 6 divide into evenly. Key relationship: LCM(a,b) = a × b / GCD(a,b).
How do I find LCM using prime factorization?
Example: LCM(12, 18). 12 = 2^2 × 3. 18 = 2 × 3^2. LCM = take highest power of each prime: 2^2 × 3^2 = 4 × 9 = 36. GCD = take lowest power of each prime: 2^1 × 3^1 = 6. This method works for any number of inputs.
What are GCD and LCM used for?
GCD: simplifying fractions (divide numerator and denominator by GCD), finding common units, RSA cryptography. LCM: finding common denominators when adding fractions (1/4 + 1/6: LCD = LCM(4,6) = 12), scheduling repeating events, gear ratios.
What does it mean for two numbers to be coprime?
Two numbers are coprime (relatively prime) if their GCD = 1. Examples: 8 and 9 (GCD=1), 14 and 15 (GCD=1). Coprime numbers have no common prime factors. Consecutive integers are always coprime. Coprimality is important in fractions, modular arithmetic, and cryptography.
Euclidean Algorithm Example
Common Examples
| a, b | GCD | LCM |
|---|---|---|
| 6, 9 | 3 | 18 |
| 8, 12 | 4 | 24 |
| 14, 21 | 7 | 42 |
| 15, 25 | 5 | 75 |
| 17, 13 | 1 | 221 |