How to find the least common multiple (LCM): formula, steps and examples

Math

How to find the least common multiple (LCM): formula, steps and examples

Published: August 4, 2026
Updated: August 4, 2026

how to find the least common multiple (LCM)

The least common multiple (LCM) of two or more integers is the smallest positive integer that is a multiple of each of them. Knowing how to find the LCM is useful for adding or subtracting fractions, solving problems with repeating cycles, scheduling events, and simplifying ratios.

what is the LCM and when to use it

The LCM of numbers a and b is the smallest positive integer m such that m % a == 0 and m % b == 0. Use the LCM when you need a common period or common denominator — for example, to add fractions like 1/6 + 1/8, or to find when repeating events with different frequencies coincide.

formula for LCM using GCD

The most reliable formula ties the LCM to the greatest common divisor (GCD):

lcm(a, b) = |a × b| / gcd(a, b)

This generalizes to more than two numbers by applying the lcm pairwise: lcm(a, b, c) = lcm(lcm(a, b), c).

how to find the gcd (greatest common divisor)

To use the formula you need the gcd. The Euclidean algorithm is fast and simple:

  • Given two positive integers x and y (x ≥ y), replace x with y and y with x mod y.
  • Repeat until y is 0. The non-zero x at that point is gcd(x, y).

step-by-step method to find the LCM manually

  1. Write down the numbers you want the LCM for (e.g., 12 and 18).
  2. Find the gcd using the Euclidean algorithm:

Example for gcd(12, 18):

  • 18 mod 12 = 6 → replace (12, 6)
  • 12 mod 6 = 0 → gcd = 6
  1. Apply the formula lcm = |a × b| / gcd.

Using the example: lcm(12, 18) = (12 × 18) / 6 = 216 / 6 = 36.

alternative method: prime factorization

You can also find the LCM by prime factorizing each number and taking the highest power of each prime present.

  • Prime factorize each number (e.g., 12 = 2² × 3, 18 = 2 × 3²).
  • For each prime, take the maximum exponent across the factorizations: 2² and 3².
  • Multiply those together: 2² × 3² = 4 × 9 = 36.

examples with step-by-step solutions

example 1 — lcm of two numbers (12 and 30)

1) gcd(12, 30) by Euclidean algorithm: 30 mod 12 = 6 → 12 mod 6 = 0 → gcd = 6.

2) lcm = (12 × 30) / 6 = 360 / 6 = 60.

example 2 — lcm of three numbers (8, 9, 21)

Method A: pairwise with gcd formula

  • lcm(8, 9) — gcd(8,9)=1 → lcm = 8×9/1 = 72
  • lcm(72, 21) — gcd(72,21)=3 → lcm = 72×21/3 = 1512/3 = 504

Method B: prime factorization

  • 8 = 2³
  • 9 = 3²
  • 21 = 3 × 7
  • Take max powers: 2³, 3², 7¹ → lcm = 8 × 9 × 7 = 504

example 3 — lcm of non-integers or negatives

LCM is normally defined for integers. For negative integers, use absolute values: lcm(-4, 6) = lcm(4, 6) = 12. For fractions, convert to integers by clearing denominators when you want a common period.

how to use an online lcm calculator

Online LCM calculators speed up the process and reduce mistakes. To use one:

  • Enter the integers separated by commas or one per field.
  • Choose whether you want intermediate steps (gcd, prime factors) shown.
  • Press compute — the tool returns the LCM and often shows work.

Try a reliable tool from Calculatorr to compute LCMs and see steps: visit the calculators section at https://calculatorr.com/ for quick results and worked examples.

interpretation: what the LCM result tells you

  • If lcm(a, b) = m, then both a and b divide m exactly. m is the smallest positive integer with that property.
  • In scheduling, m represents the first time two repeating events align if one repeats every a units and the other every b units.
  • When adding fractions like 1/a + 1/b, the LCM is the least common denominator to combine the fractions without reducing immediately.

common mistakes and how to avoid them

  • Forgetting to use absolute values: use |a × b| in the formula.
  • Mixing up gcd and lcm: gcd is the greatest common divisor (common factor), lcm is the least common multiple.
  • Applying formula without integer inputs: ensure inputs are integers (or convert fractions appropriately).
  • Using pairwise lcm incorrectly for many numbers: apply lcm iteratively and avoid rounding during intermediate steps.

quick reference table: lcm of small integers

NumbersLCM
2 and 36
4 and 612
5 and 735
6, 8, and 972
10 and 1530

tips for fast mental lcm (practical heuristics)

  • If numbers are coprime (gcd=1), lcm = product — multiply directly.
  • For multiples (one divides the other), lcm is the larger number (e.g., lcm(6, 18)=18).
  • Use prime factors for three or more numbers — take highest exponents only once.

when lcm is particularly useful in real life

  • Scheduling repeating maintenance, traffic signal coordination, or work shifts.
  • Finding common denominators for fraction arithmetic in budgets, recipes or engineering.
  • Solving word problems that ask when two or more cyclical events coincide.

If you prefer an interactive approach, use the LCM calculator on Calculatorr to enter any list of integers and get the result with steps. The tool helps check manual work and is handy for homework, planning, and quick problem solving.

Why Choose Calculatorr.com?

We're dedicated to providing the most accurate, easy-to-use calculators for all your needs.

100% Free

All of our calculators are completely free to use, no hidden fees or subscriptions.

Private & Secure

Your data never leaves your browser. We don't store any of your calculations.

Mobile Friendly

Use our calculators on any device - desktop, tablet, or smartphone.