Least Common Multiple

Smallest multiple of both numbers.

LCM
12

How to Use the LCM Calculator

  1. Enter the first integer into the **Number 1** field (e.g., 12).
  2. Enter the second integer into the **Number 2** field (e.g., 18). Add more number fields if you need the LCM of three or more values.
  3. Click **Calculate**. The calculator applies the GCD-based formula iteratively across all inputs.
  4. Read the **LCM result** displayed. You can also view the step-by-step prime factorization or Euclidean algorithm breakdown for verification.
  5. Use the **Reset** button to clear all fields and start a new calculation.

LCM Formula Using the GCD

LCM(a, b) = |a × b| ÷ GCD(a, b)

The most efficient way to compute the LCM of two integers a and b is through their Greatest Common Divisor (GCD), using the identity:

LCM(a, b) = |a × b| ÷ GCD(a, b)

This works because the product of two numbers equals the product of their LCM and GCD. For more than two numbers, apply the formula iteratively:

LCM(a, b, c) = LCM(LCM(a, b), c)

The GCD itself is most efficiently found using the Euclidean algorithm: repeatedly replace the larger number with the remainder of dividing the larger by the smaller until the remainder is zero; the last non-zero remainder is the GCD.

  • a — The first positive integer input.
  • b — The second positive integer input.
  • GCD(a, b) — The Greatest Common Divisor of a and b — the largest integer that divides both a and b without a remainder.
  • LCM(a, b) — The Least Common Multiple of a and b — the smallest positive integer divisible by both a and b.

Worked Example: LCM of 12 and 18

a = 12, b = 18
Step 1 – Find GCD(12, 18) using the Euclidean algorithm:
  18 ÷ 12 = 1 remainder 6
  12 ÷ 6  = 2 remainder 0
  → GCD(12, 18) = 6

Step 2 – Apply the LCM formula:
  LCM(12, 18) = |12 × 18| ÷ 6 = 216 ÷ 6 = 36

Result: LCM(12, 18) = **36**

What Your Result Means

The result 36 is the smallest positive integer that both 12 and 18 divide into evenly. You can verify: 36 ÷ 12 = 3 (no remainder) and 36 ÷ 18 = 2 (no remainder). No positive integer smaller than 36 satisfies both conditions.

Understanding LCM

Understanding the Least Common Multiple

Why LCM Matters

The LCM appears in many practical situations:

  • Adding or subtracting fractions – The LCM of the denominators gives the lowest common denominator (LCD), keeping numbers as small as possible.
  • Scheduling & cycles – If event A repeats every 12 days and event B every 18 days, they next coincide after LCM(12, 18) = 36 days.
  • Music & rhythm – Polyrhythms resolve at the LCM of their cycle lengths.
  • Engineering – Gear ratios and signal synchronisation rely on LCM calculations.

Two Methods for Finding the LCM

Method 1 – Using the GCD (recommended for large numbers) As shown in the formula, dividing the product of the two numbers by their GCD is fast and minimises arithmetic, especially for large values.

Method 2 – Prime Factorisation

  1. Write each number as a product of prime factors.
  2. For each prime that appears in any factorisation, take the highest power present.
  3. Multiply those highest powers together.

Example with 12 and 18:

  • 12 = 2² × 3¹
  • 18 = 2¹ × 3²
  • LCM = 2² × 3² = 4 × 9 = 36

LCM vs GCD

| | GCD | LCM | |---|---|---| | Definition | Largest common divisor | Smallest common multiple | | Use case | Simplifying fractions | Finding common denominators | | Relationship | GCD(a,b) × LCM(a,b) = a × b | same identity |

Special Cases

  • LCM of coprime numbers (GCD = 1): LCM(a, b) = a × b. For example, LCM(7, 11) = 77.
  • LCM of a number and itself: LCM(n, n) = n.
  • LCM involving 1: LCM(1, n) = n for any positive integer n.
  • More than two numbers: Apply the formula in pairs: LCM(a, b, c) = LCM(LCM(a, b), c).

Common Mistakes

  • **Confusing LCM with GCD** – The LCM is the *smallest common multiple* (always ≥ the largest input), while the GCD is the *largest common divisor* (always ≤ the smallest input). They are inverses in purpose.
  • **Using the product as the LCM** – The product a × b equals the LCM only when GCD(a, b) = 1 (the numbers are coprime). Otherwise the true LCM is smaller.
  • **Entering non-integer values** – LCM is defined only for positive integers. Entering decimals or fractions will give a meaningless result; convert to integers first if needed.
  • **Forgetting to list all prime factors** – When using the prime factorisation method, omitting even one prime factor leads to a result that is not actually divisible by all inputs.
  • **Stopping at the first common multiple found by listing** – When listing multiples manually, it is easy to make arithmetic errors. The GCD-based formula or prime factorisation is more reliable.

Common Questions About LCM

What is the relationship between LCM and GCD?

For any two positive integers a and b, the product of their LCM and GCD always equals the product of the numbers themselves: LCM(a, b) × GCD(a, b) = a × b. This identity is the basis of the fastest LCM calculation method.

How is LCM used when adding fractions?

To add fractions with different denominators, find the LCM of the denominators to get the lowest common denominator. Convert each fraction to an equivalent fraction with that denominator, then add the numerators. For example, 1/12 + 1/18 uses LCD = LCM(12,18) = 36, giving 3/36 + 2/36 = 5/36.

What is the LCM of prime numbers?

Any two distinct prime numbers are coprime (GCD = 1), so their LCM is simply their product. For example, LCM(7, 13) = 91. For a prime p and a composite number n, LCM(p, n) = p × n if p does not divide n, otherwise LCM(p, n) = n.

Can LCM be applied to negative integers?

The LCM is typically defined for positive integers. Some definitions extend it to negative integers by taking absolute values first, so LCM(−12, 18) = LCM(12, 18) = 36. Our calculator works with positive integers only.

Frequently Asked Questions

What is the LCM of 0 and any number?

Mathematically, the LCM is undefined when either input is 0, because zero has no positive multiples. Our calculator requires positive integers greater than zero.

Can the LCM ever be smaller than the largest input number?

No. By definition, the LCM must be divisible by every input number, so it is always greater than or equal to the largest number in your list. It equals the largest input only when the largest input is itself a multiple of all the others.

How do I find the LCM of three or more numbers?

Apply the formula iteratively: compute LCM of the first two numbers, then compute the LCM of that result with the third number, and so on. Our calculator handles this automatically when you add extra number fields.

Is the LCM the same as the Lowest Common Denominator (LCD)?

Yes — when adding or subtracting fractions, the LCD of the denominators is exactly the LCM of those denominators. Using the LCM keeps the numbers as small as possible.

Does the order of inputs change the LCM?

No. LCM is commutative and associative: LCM(a, b) = LCM(b, a), and the order in which you process a list of numbers does not affect the final answer.

Related Calculators

Sources

Only sources that have been reviewed are shown. Unverified citations are never published.

Spotted a calculation error?Report an Error