🔢 Maths

LCM Calculator

Calculate least common multiple of numbers.

Calculate lcm

Result
£0

How it works

The least common multiple is the smallest positive whole number that both of your numbers divide into exactly. It is the number you use when adding fractions with different denominators, and when two repeating events next land on the same step (a 12-minute bus and an 18-minute bus).

In UK classrooms it is often called the lowest common multiple. The calculation is exact for positive integers.

For two numbers, lcm(a, b) = |a × b| ÷ gcd(a, b).

Find the GCD with the Euclidean algorithm (see the GCD page), then divide the product by it. Do the division last so you are not handling a huge product unnecessarily: lcm(a, b) = a ÷ gcd(a, b) × b, dividing first.

For three numbers, lcm(a, b, c) = lcm(lcm(a, b), c). From prime factors, take each prime to the higher power rather than the lower one.

Worked example

lcm(12, 18). gcd(12, 18) = 6, because 18 = 1 × 12 + 6 and 12 = 2 × 6 + 0.

lcm = 12 ÷ 6 × 18 = 2 × 18 = 36. Check: 36 ÷ 12 = 3 and 36 ÷ 18 = 2, and no smaller positive candidate works. Prime factors: 12 = 2² × 3, 18 = 2 × 3², so the LCM is 2² × 3² = 36.

To add 1/12 and 1/18, the common denominator is 36. 1/12 = 3/36 and 1/18 = 2/36, so the sum is 5/36.

Questions and answers

Is the LCM just the product?

Only when the numbers are coprime, so the GCD is 1. 4 and 9 have LCM 36, which is the product. 12 and 18 do not. Multiplying every time makes fractions harder, not easier.

What about more than two numbers?

Pair them. lcm(12, 18, 24) = lcm(36, 24). gcd(36, 24) = 12, so lcm = 36 ÷ 12 × 24 = 72. Pairing order does not change the result.

Can the LCM be one of the inputs?

Yes. If one number is a multiple of the other, the LCM is the larger one. lcm(8, 24) = 24. That is the case when you were about to hunt for a bigger denominator you do not need.

How is this used outside fractions?

Any two regular cycles: gear teeth, repeating rotas, or “every 12 days” and “every 18 days” coincide every 36 days if they start together. If they do not start together, the LCM is still the length of the combined pattern, but the first coincidence may be sooner. Count from the actual start dates with the date-difference page.