GCF and LCM Calculator
Greatest common factor and least common multiple of two numbers.
What it does
Two numbers share divisors and multiples, and the extremes of each family do the real work. The greatest common factor reduces fractions and ratios, while the least common multiple aligns cycles, schedules, and denominators.
The tool above takes two whole numbers. It returns the GCF by Euclid method, the LCM from it, and whether the pair is coprime.
Euclid algorithm needs no factoring: replace the pair by the smaller number and the remainder, and repeat until nothing remains. The last nonzero remainder is the GCF, reached in a handful of steps even for huge inputs.
Coprime pairs share nothing but one. Their LCM is simply the product, which is why unrelated gear teeth and encryption keys favor them.
How to use
- Enter two whole numbers. Negatives work by size.
- Read the GCF first for reducing duty.
- Read the LCM for aligning cycles.
- Check coprime status for fraction and key questions.
Formula
- a mod b
- Remainder driving each Euclid step.
- |x·y|
- Absolute product scaled down by shared factors.
- coprime
- GCD 1: no shared factor exists.
Zero pairs with any number as itself: gcd(0, n) is n, and LCM with zero is zero. Double zero stays undefined.
Worked example
Example: GCF and LCM of 48 and 180
Numbers 48 and 180.
- Euclid: 180 mod 48 = 36. Then 48 mod 36 = 12. Then 36 mod 12 = 0.
- Last nonzero remainder: GCF 12.
- LCM: 48 x 180 / 12 = 8640 / 12 = 720.
- Check: 720 / 48 = 15 and 720 / 180 = 4, both whole.
- Verdict: share GCD 12, not coprime.
Reference table
| Pair | GCF | LCM |
|---|---|---|
| 6 and 8 | 2 | 24 |
| 12 and 18 | 6 | 36 |
| 7 and 13 | 1 (coprime) | 91 |
| 48 and 180 | 12 | 720 |
| 100 and 75 | 25 | 300 |
Limits
- Whole numbers under a trillion.
- Two inputs modeled. More need pairwise reduction.
- Signs ignored for size math.
- Double zero undefined.
Common mistakes
- Listing multiples upward instead of reducing with Euclid.
- Confusing GCF with LCM direction.
- Forgetting zero pairs: gcd(0, n) is n.
- Stopping Euclid one step early.
- Assuming coprime means both prime.
Try it yourself
Quick checks. Answers sit tucked under each question.
GCF and LCM of 12 and 18?
GCF 6. LCM 12x18/6 = 36.
Are 8 and 15 coprime? LCM?
Yes, GCD 1. LCM 8x15 = 120.
Questions
What is GCF used for?
Reducing fractions and ratios to lowest terms in one division.
What is LCM used for?
Common denominators, repeating schedules, and gear or cycle alignment.
How does Euclid algorithm work?
Replace (a, b) with (b, remainder) until zero. The last remainder is the GCF.
What does coprime mean?
GCD of 1. The numbers share no factor, so LCM is their product.
Can GCF exceed the numbers?
No. It divides both, so it fits inside the smaller.
What about three numbers?
Reduce pairwise: gcd(a, b, c) equals gcd(gcd(a, b), c). Same for LCM.