LCM Calculator
Enter two to ten whole numbers to find their least common multiple, with the prime factors and every step.
Inputs
Least common multiple
72
The smallest positive number that all of 12, 18 and 24 divide with no remainder.
- Greatest common divisor
- 6
- LCM in prime factors
- 2³ × 3²
- Next common multiples
- 144, 216
Step-by-step solution
Break each number into prime factors.
12 = 2² × 3, 18 = 2 × 3², 24 = 2³ × 3
For each prime, keep the highest power that appears in any of the numbers.
2³ (from 24), 3² (from 18)
Multiply those prime powers together.
LCM = 2³ × 3² = 8 × 9 = 72
Check by combining two numbers at a time, since lcm(a, b, c) = lcm(lcm(a, b), c).
lcm(12, 18) = 36, lcm(36, 24) = 72
Confirm that each number divides the result with no remainder.
72 ÷ 12 = 6, 72 ÷ 18 = 4, 72 ÷ 24 = 3
Formulas used
LCM = product of the highest power of each prime prime factorisation method
LCM(a, b) = a × b / GCD(a, b) for two numbers
lcm(a, b, c) = lcm(lcm(a, b), c) for three or more, two at a time
- a, b, c
- the whole numbers you entered
- GCD
- the greatest common divisor, the largest number that divides both
- LCM
- the least common multiple, the smallest number both divide into
A multiple of 12 is anything in its times table: 12, 24, 36 and so on. The common multiples of 12 and 18 are the numbers that appear in both lists, and the smallest of them, 36, is the LCM. Listing multiples works for small numbers, but it gets slow quickly, so the calculator uses prime factors instead.
Every whole number is a product of primes, and a number divides another only when its primes and their powers are all present. To be divisible by 12 = 2² × 3 and by 18 = 2 × 3², a number needs at least 2² and at least 3². Taking the highest power of each prime builds the smallest number that qualifies, which is why the rule is "highest power" and not "all the primes" or "the shared primes".
The GCD rule comes from the same idea. The primes two numbers share are counted twice in their product, and dividing by the GCD removes the double count.
Worked example: the LCM of 12 and 18
Numbers a = 12 and b = 18.
12 = 2² × 3 and 18 = 2 × 3²
Highest power of 2: 2² Highest power of 3: 3²
LCM = 2² × 3² = 4 × 9 = 36
Check: GCD(12, 18) = 6, so 12 × 18 / 6 = 216 / 6 = 36
Listing multiples agrees. The multiples of 12 are 12, 24, 36, 48 and the multiples of 18 are 18, 36, 54, so 36 is the first number on both lists.
A real use: two buses leave a station together, one every 12 minutes and one every 18 minutes. They leave together again after 36 minutes, the LCM of the two intervals.
LCM of common pairs of numbers
The GCD column shows how much each pair overlaps. The more the numbers share, the smaller the LCM is compared with their product. Coprime pairs have a GCD of 1, and their LCM equals their product.
| Numbers | GCD | LCM | Coprime? |
|---|---|---|---|
| 2, 3 | 1 | 6 | Yes |
| 4, 6 | 2 | 12 | No |
| 6, 8 | 2 | 24 | No |
| 8, 12 | 4 | 24 | No |
| 9, 12 | 3 | 36 | No |
| 12, 15 | 3 | 60 | No |
| 12, 18 | 6 | 36 | No |
| 15, 20 | 5 | 60 | No |
| 16, 24 | 8 | 48 | No |
| 18, 24 | 6 | 72 | No |
| 21, 35 | 7 | 105 | No |
| 25, 40 | 5 | 200 | No |
LCM of common groups of three
Three numbers can have a GCD of 1 even when no two of them are coprime. 6, 10 and 15 are an example: each pair shares a factor, but all three share none, and the LCM is 30.
| Numbers | GCD | LCM | Pairwise coprime? |
|---|---|---|---|
| 2, 3, 5 | 1 | 30 | Yes |
| 3, 4, 5 | 1 | 60 | Yes |
| 4, 6, 8 | 2 | 24 | No |
| 6, 10, 15 | 1 | 30 | No |
| 12, 18, 24 | 6 | 72 | No |
| 10, 15, 25 | 5 | 150 | No |
Frequently asked questions
What is the difference between the LCM and the GCF?
The least common multiple is the smallest number that all of your numbers divide into. The greatest common factor (also called the GCD or HCF, each with its own GCF and HCF calculator here) is the largest number that divides into all of them. For 12 and 18 the GCF is 6 and the LCM is 36.
The GCF can never be larger than the smallest number you entered. The LCM can never be smaller than the largest.
How are the LCM and GCD of two numbers related?
Multiplying them gives the same result as multiplying the two numbers: LCM(a, b) × GCD(a, b) = a × b. For 12 and 18, 36 × 6 = 216 = 12 × 18. This only holds for two numbers. With three or more, combine them two at a time instead.
What is the LCM of two numbers that share no factors?
Their product. Numbers with a GCD of 1 are called coprime, and 8 and 9 are an example: the LCM is 8 × 9 = 72. Any two different primes are coprime, so the LCM of 7 and 13 is 91.
What is the LCM of a number and 1?
The number itself. Every whole number is a multiple of 1, so the smallest common multiple of 1 and 9 is 9. More generally, if one number is a multiple of all the others, it is the LCM, which is why the LCM of 5 and 20 is 20.
How do I find the LCM of three or more numbers?
Either factor every number and keep the highest power of each prime, or work two numbers at a time: lcm(a, b, c) = lcm(lcm(a, b), c). The calculator shows both. For 12, 18 and 24, lcm(12, 18) = 36 and lcm(36, 24) = 72.
Why is the LCM used to add fractions?
Fractions can only be added when they share a denominator, and the smallest shared denominator is the LCM of the original ones. To add 1/6 and 1/8, use LCM(6, 8) = 24: 4/24 + 3/24 = 7/24. Any common multiple works, but the LCM keeps the numbers small and the answer easier to simplify.
Can I find the LCM of 0 or of negative numbers?
This calculator takes positive whole numbers only. Every number divides 0, so there is no smallest positive common multiple that includes it. For negative numbers the convention is to ignore the sign, so use the positive values.
How large a number can it handle?
Each number can have up to 12 digits, and you can enter up to ten of them. The result is calculated exactly with whole-number arithmetic, so even a 100-digit LCM is shown in full with no rounding.