GCD & LCM Calculator
Calculate the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) for multiple numbers. Includes step-by-step Euclidean algorithm and Bezout coefficients.
GCD and LCM Calculator
Calculate both GCD and LCM for a set of numbers
How to Use the GCD & LCM Calculator
Enter two or more numbers separated by commas or spaces, select the calculation type, and click Calculate. The calculator shows the results along with prime factorizations and step-by-step solutions.
Calculator Modes
GCD (Greatest Common Divisor)
Also known as Highest Common Factor (HCF) or Greatest Common Factor (GCF). The GCD is the largest positive integer that divides all given numbers without a remainder. For example, GCD(12, 18) = 6.
LCM (Least Common Multiple)
The LCM is the smallest positive integer that is divisible by all given numbers. For example, LCM(4, 6) = 12. The LCM is useful for finding common denominators in fractions.
GCD & LCM Combined
Calculate both values at once. For two numbers a and b, there's a useful relationship: GCD(a,b) × LCM(a,b) = |a × b|
Extended Euclidean Algorithm
Finds the GCD along with Bezout coefficients x and y such that ax + by = GCD(a,b). This is essential in cryptography, modular arithmetic, and solving Diophantine equations.
The Euclidean Algorithm
The calculator uses the Euclidean algorithm, one of the oldest known algorithms (dating back to 300 BC). It works by repeatedly replacing the larger number with the remainder when divided by the smaller, until the remainder is zero.
Common Applications
- Simplifying fractions to lowest terms
- Finding common denominators for adding fractions
- RSA cryptography and key generation
- Solving modular arithmetic problems
- Music theory (time signatures, rhythms)
- Gear ratio calculations in engineering
Prime Factorization Method
You can also find GCD and LCM using prime factorization:
- GCD: Take the minimum power of each common prime factor
- LCM: Take the maximum power of each prime factor (from all numbers)