GCD & LCM Calculator
Calculate Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of two numbers. Perfect for math homework, fractions, and number theory.
Calculate GCD & LCM
Enter two positive integers to find their GCD and LCM
π Quick Examples
You Might Also Like
Explore more tools in this category
About GCD & LCM Calculator
Our GCD & LCM Calculator helps you find the Greatest Common Divisor and Least Common Multiple of two numbers instantly. Essential for mathematics, fractions, and number theory problems.
What is GCD?
The Greatest Common Divisor (GCD), also known as the Highest Common Factor (HCF) or Greatest Common Factor (GCF), is the largest positive integer that divides both numbers without a remainder.
Example: GCD(12, 18) = 6 because 6 is the largest number that divides both 12 and 18.
What is LCM?
The Least Common Multiple (LCM) is the smallest positive integer that is divisible by both numbers. It's the smallest number that both numbers divide into evenly.
Example: LCM(12, 18) = 36 because 36 is the smallest number divisible by both 12 and 18.
How to Calculate GCD
We use the Euclidean algorithm, which is efficient and works by repeatedly replacing the larger number with the remainder of dividing the larger by the smaller:
- Divide the larger number by the smaller number
- Replace the larger number with the smaller number
- Replace the smaller number with the remainder
- Repeat until the remainder is 0
- The last non-zero remainder is the GCD
How to Calculate LCM
Once you have the GCD, you can calculate LCM using the formula:
LCM(a, b) = (a Γ b) Γ· GCD(a, b)
Common Use Cases
- Fractions: Simplifying fractions using GCD, finding common denominators using LCM
- Scheduling: Finding when events coincide
- Geometry: Tiling problems and patterns
- Music: Finding rhythm patterns
- Programming: Algorithm optimization
- Cryptography: Number theory applications
Properties of GCD
- GCD(a, b) = GCD(b, a) (commutative)
- GCD(a, 0) = a
- GCD(a, 1) = 1
- GCD(a, a) = a
- If GCD(a, b) = 1, a and b are coprime (relatively prime)
Properties of LCM
- LCM(a, b) = LCM(b, a) (commutative)
- LCM(a, 1) = a
- LCM(a, a) = a
- LCM(a, b) β₯ max(a, b)
- GCD(a, b) Γ LCM(a, b) = a Γ b
Real-World Examples
- Simplifying Fractions: To simplify 12/18, divide both by GCD(12, 18) = 6 to get 2/3
- Common Denominators: To add 1/12 + 1/18, find LCM(12, 18) = 36 as common denominator
- Scheduling: If bus A comes every 12 minutes and bus B every 18 minutes, they meet every LCM(12, 18) = 36 minutes
- Tiling: To tile a 12Γ18 floor with square tiles, use GCD(12, 18) = 6 inch tiles
Special Cases
- Prime Numbers: GCD of two primes is always 1
- One divides the other: If a divides b, then GCD(a, b) = a and LCM(a, b) = b
- Coprime Numbers: If GCD(a, b) = 1, then LCM(a, b) = a Γ b
- Same Numbers: GCD(a, a) = LCM(a, a) = a
Tips for Students
- List factors to find GCD manually
- List multiples to find LCM manually
- Use prime factorization for complex numbers
- Remember: GCD Γ LCM = Product of the two numbers
- Practice with small numbers first
Related Concepts
- Coprime: Two numbers with GCD = 1
- Prime Factorization: Breaking numbers into prime factors
- Divisibility: When one number divides another evenly
- Modular Arithmetic: Remainder after division
Multiple Numbers
For more than two numbers, calculate GCD and LCM iteratively:
- GCD(a, b, c) = GCD(GCD(a, b), c)
- LCM(a, b, c) = LCM(LCM(a, b), c)