Skip to content

LCM Calculator – Least Common Multiple

Updated:

Find the least common multiple and greatest common divisor of 2 to 10 positive integers. Enter numbers separated by commas or spaces to see their prime factorizations and the steps behind the LCM.

Find the LCM of Whole Numbers

Input Fields
If enabled, the result will update automatically when you change any value.

LCM Formula

Formula
\[\operatorname{LCM}(a_1,a_2,\ldots,a_n)=\prod_{p}p^{\max\left(v_p(a_1),v_p(a_2),\ldots,v_p(a_n)\right)}\]

Where:

  • \(a_1,a_2,\ldots,a_n\) — the positive integers entered.
  • \(p\) — a prime factor of at least one entered number.
  • \(v_p(a_i)\) — the exponent of \(p\) in the prime factorization of \(a_i\); it is 0 if \(p\) is not a factor.

For each prime that appears, take its highest exponent among the entered numbers. Multiplying those prime powers gives the smallest positive integer divisible by every entry.

LCM – Calculation Example

Example: find the LCM of the default entries 12, 18, and 30.

Factor each number, then select the highest power of each prime:

\[12=2^2\times3,\qquad18=2\times3^2,\qquad30=2\times3\times5\]

\[\operatorname{LCM}(12,18,30)=2^2\times3^2\times5=4\times9\times5=180\]

Result: the LCM is 180. The calculator also reports a GCD of 6.

How to use the calculator

  1. In Positive integers, enter 2 to 10 numbers separated by commas or spaces. For example, enter 12, 18, 30.
  2. Read Least common multiple (LCM) for the smallest positive number divisible by every entry.
  3. Check Greatest common divisor (GCD) for the largest positive number that divides every entry without a remainder.
  4. Use Prime factorization of each number to see how each entry breaks down. Highest power of each prime shows which factors to keep, and Product of the highest powers shows how they combine to produce the LCM.

What the least common multiple means

A multiple of a positive integer is that integer multiplied by another whole number. The least common multiple, or LCM, is the smallest positive multiple shared by all the numbers you enter. For instance, 180 is divisible by 12, 18, and 30; no smaller positive integer is divisible by all three. A larger common multiple, such as 360, works too, but it is not the least one.

The LCM is useful when quantities must be expressed in compatible units or repeating events must line up. If one event repeats every 12 days and another every 18 days, they coincide every 36 days when they start together. For fractions, the LCM of the denominators provides a least common denominator, making the fractions easier to add or compare.

Prime factorization explains why the calculation works. Each input must divide the result, so the result needs at least as many copies of every prime as the input with the highest exponent. In the example, 18 supplies \(3^2\), 12 supplies \(2^2\), and 30 supplies \(5\). Keeping all three highest powers gives 180. You can inspect an individual number in the Prime Factorization Calculator or use the Prime Number Checker to check whether a factor is prime.

The GCD answers a different question: what is the largest number that divides every entry? For 12, 18, and 30, that number is 6. The LCM takes the highest power of each prime needed across the inputs, whereas the GCD keeps only prime powers common to all of them. For two positive numbers \(a\) and \(b\), you can check the results with \(\operatorname{LCM}(a,b)\times\operatorname{GCD}(a,b)=a\times b\). That identity should not be applied unchanged to three or more numbers.

Input limits and practical tips

  • Enter 2 to 10 positive integers. Each entry must be between 1 and 1,000,000,000,000. Zero, negative numbers, decimals, and fractions are not accepted.
  • Use commas or spaces between entries, not as thousands separators. For example, 1000 2500 represents two numbers, while 1,000, 2,500 is read as four numbers.
  • Including 1 does not increase the LCM. Repeating an entry does not change either the LCM or GCD.
  • If the numbers share no prime factor across all entries, their GCD is 1. This does not necessarily mean their LCM is their product: that shortcut requires the numbers to be pairwise coprime.
  • The LCM can be much larger than any individual input, especially when the entries share few factors. Its size alone is not an error; check the displayed prime powers to see how it was formed.

Frequently Asked Questions

How can I find the LCM by hand without prime factorization?

For two numbers, find their GCD with the Euclidean algorithm, then use \(\operatorname{LCM}(a,b)=a\times(b/\operatorname{GCD}(a,b))\). For example, the GCD of 14 and 20 is 2, so their LCM is \(14\times(20/2)=140\). For more numbers, repeat the process using the previous LCM and the next number.

When is the LCM equal to one of the numbers entered?

The LCM equals the largest entry when that entry is divisible by every other entry. For example, the LCM of 4, 6, and 12 is 12 because 12 is a multiple of both 4 and 6. If even one entry does not divide the largest, the LCM must be larger.

If the GCD is 1, can I multiply all the numbers to get the LCM?

Not always. A GCD of 1 means no factor divides every entry, but some pairs may still share factors. For example, 6, 10, and 15 have a GCD of 1, yet their LCM is 30, not their product of 900. Multiplying all entries works when every pair is coprime.

How do I use the LCM to add fractions with different denominators?

Find the LCM of the denominators, then rewrite each fraction with that denominator before adding the numerators. For example, the LCM of 6 and 8 is 24, so \(1/6=4/24\) and \(1/8=3/24\). Their sum is \(7/24\). This gives the least common denominator, although the final fraction may still need simplifying.

Does the LCM tell me when events with different start times first coincide?

No. The LCM gives the interval between coincidences, but a different first coincidence may occur when the events start at different times. If one event occurs every 4 days starting on day 0 and another every 6 days starting on day 2, they first coincide on day 8. They then coincide every 12 days, the LCM of 4 and 6.

Is there an LCM for zero or negative numbers?

In mathematics, negative inputs are usually handled using their absolute values, so the LCM of −6 and 8 is 24. Zero requires care: some conventions define the LCM of 0 and a nonzero integer as 0, while the usual definition as the smallest positive common multiple does not apply. This calculator uses positive integers only.

Leave a Reply

Your email address will not be published. Required fields are marked *