How to find the GCD and LCM
The GCD (greatest common divisor) is the largest number that divides all the given numbers. The LCM (least common multiple) is the smallest number divisible by each of them. For 12, 18 and 30: GCD = 6, LCM = 180.
The calculator finds the GCD with Euclid’s algorithm — it replaces the larger number with the remainder of dividing by the smaller one until the remainder is zero. The LCM comes from LCM(a, b) = a × b ÷ GCD(a, b). It works for any number of values of any size.
Euclid’s algorithm step by step
| Step | Operation | Remainder |
|---|---|---|
| 1 | 18 ÷ 12 | 6 |
| 2 | 12 ÷ 6 | 0 |
The last non-zero remainder is GCD(18, 12) = 6. LCM(12, 18) = 12 × 18 ÷ 6 = 36.
What they’re used for
- GCD — simplifying fractions: 18/30 divided by GCD = 6 is 3/5.
- LCM — common denominators: 1/12 + 1/18 = 3/36 + 2/36.
- LCM — cycle problems: buses leaving every 12 and 18 minutes meet again after 36 minutes.
Frequently asked questions
How do I enter the numbers?
Separate them with commas, spaces or semicolons: “12, 18, 30”. You need at least two positive whole numbers.
What if the GCD is 1?
The numbers are coprime — they share no divisor other than 1, and for two numbers their LCM is simply their product.