mode
GCD and LCM Calculator
Find the GCD and LCM of two integers using prime factorization with a Venn diagram.
Click to show tips
Try an Example
Pick a scenario to see how the calculator works, then adjust the values
Highly Composite Number
Factor 360, a highly composite number with many divisors.
Key values: 360 = 2^3 x 3^2 x 5 · 24 divisors · phi(360) = 96
Large Prime
Check if 7919 is prime (it is -- the 1000th prime number).
Key values: 7919 is prime · 2 divisors · phi(7919) = 7918
GCD and LCM
Compute the GCD and LCM of 84 and 120.
Key values: 84 = 2^2 x 3 x 7 · 120 = 2^3 x 3 x 5 · GCD = 12, LCM = 840
GCD and LCM via Prime Factorization
Once you have the prime factorizations of two numbers, GCD and LCM follow directly:
Take each shared prime at the minimum exponent.
Take every prime (from either number) at the maximum exponent.
The Fundamental Identity
This identity means you only need to compute one (GCD or LCM) and derive the other. Euclid's algorithm computes GCD in time without needing factorization.
Practical Examples
Simplifying Fractions
To simplify 48/180: factor and . . Divide both by 12: .
Scheduling Problems
Two buses arrive every 12 and 18 minutes. When do they coincide? minutes.
Gear Ratio Simplification
Gears with 24 and 36 teeth: . Simplest ratio: 2:3.
Frequently Asked Questions
What is the difference between GCD and LCM?
The GCD (Greatest Common Divisor) is the largest number that divides both integers evenly. The LCM (Least Common Multiple) is the smallest positive number that both integers divide into evenly. For 12 and 18: GCD = 6, LCM = 36.
How do you find GCD using prime factorization?
Factor both numbers into primes, then take each shared prime at its minimum exponent. For example, and . The shared primes are 2 and 3, so .
How do you find LCM using prime factorization?
Factor both numbers into primes, then take every prime (from either number) at its maximum exponent. For and : .
What is the relationship between GCD and LCM?
For any two positive integers and , . This identity lets you compute one from the other. For example, and , and .
When are two numbers coprime?
Two numbers are coprime (or relatively prime) when their GCD is 1, meaning they share no common prime factors. For example, 8 and 15 are coprime because and share no primes. A fraction is already in lowest terms when and are coprime.
More Math Calculators
Explore the category