Calculatrixe

Least Common Multiple Calculator

Find the least common multiple (LCM) of two to twenty whole numbers. The calculator shows the working with the greatest common divisor and the prime factorisation of each number, which is the method taught in class.

Inputs

Two to 20 whole numbers, separated by spaces or new lines.

Result

Enter at least two whole numbers.

The calculation runs in this browser tab. Nothing you enter is uploaded, saved or logged.

What is the least common multiple?

The least common multiple of a set of positive whole numbers is the smallest number that is a multiple of every one of them. The multiples of 4 are 4, 8, 12, 16… and those of 6 are 6, 12, 18…; the first one they share is 12, so LCM(4, 6) = 12.

The LCM is what you need to add fractions with different denominators (the lowest common denominator is the LCM of the denominators) and to find when repeating cycles line up again, for example buses that leave every 12 and 18 minutes meet again after 36 minutes.

How to use the Least Common Multiple Calculator

  1. Type two or more whole numbers, separated by spaces or new lines.
  2. Read the least common multiple. The working shows the formula with your numbers.
  3. The table lists the prime factorisation of every number and of the LCM, so you can see which prime powers were kept.
  4. Use Copy result to copy the LCM, or Reset to clear the list.

Formula

Two numbers
LCM(a, b) = |a × b| ÷ GCD(a, b)
More than two numbers
LCM(a, b, c) = LCM(LCM(a, b), c)
Prime factorisation
LCM = product of each prime at its highest power in any number

For 12 = 2² × 3 and 18 = 2 × 3², the highest power of 2 is 2² and the highest power of 3 is 3², so the LCM is 2² × 3² = 36.

Dividing by the GCD before multiplying avoids needlessly large intermediate numbers: 4 × 6 = 24, and 24 ÷ GCD 2 = 12.

Worked example

The LCM of 12, 18 and 30, for example the day when three events that repeat every 12, 18 and 30 days coincide again:

QuestionResult
Input: Whole numbers12, 18, 30
Least common multiple180
Numbers12, 18, 30
Greatest common divisor6

Assumptions and limits

  • Only whole numbers are accepted. Negative numbers use their absolute value.
  • If any number is 0 the LCM is 0, because 0 is the only common multiple; the page says so.
  • Between two and 20 numbers can be entered, each with up to 30 digits. The result is exact and can be much larger than the inputs.
  • Prime factorisation is by trial division up to 1,000,000; a remaining factor above that is shown as unfactored when it is not known to be prime, which does not affect the LCM itself.

Frequently asked questions

How do I find the least common multiple?

Either list multiples of each number until one appears in every list, or use the formula LCM(a, b) = a × b ÷ GCD(a, b). With prime factorisations, multiply together each prime at its highest power across the numbers.

What is the difference between LCM and GCD?

The GCD is the largest number that divides all the numbers, so it is never larger than the smallest of them. The LCM is the smallest number that all of them divide, so it is never smaller than the largest. For two numbers, GCD × LCM = a × b.

How do I add fractions with different denominators using the LCM?

Use the LCM of the denominators as the common denominator. For 1/4 + 1/6 the LCM of 4 and 6 is 12, so the sum is 3/12 + 2/12 = 5/12.

What is the LCM of two coprime numbers?

Their product. If two numbers share no factor other than 1 their GCD is 1, so LCM(a, b) = a × b. For example LCM(8, 15) = 120.

Can the LCM be found for more than two numbers?

Yes. Enter up to 20 numbers; the calculator combines them one at a time. The LCM of 2 to 10 is 2,520, the smallest number divisible by every whole number from 1 to 10.

What is the LCM when one number is 0?

0. The only number that is a multiple of 0 is 0 itself, so the LCM of any set containing 0 is 0. Some textbooks leave it undefined; the calculator follows the convention that makes the formulas work and states it in the details.