The least common multiple (LCM) is the smallest positive integer that's divisible by two or more given integers. It shows up constantly in fraction arithmetic, scheduling problems, and modular arithmetic, and it ties together ideas like prime factorization and GCD that run throughout number theory and abstract algebra.
Definition and concept
Meaning of LCM
The LCM of two or more integers is the smallest positive integer that each of them divides into evenly. For example, because 12 is the first number that appears in both the list of multiples of 4 (4, 8, 12, 16, ...) and the list of multiples of 6 (6, 12, 18, ...).
You can calculate it directly using:
This formula is efficient because it leverages the GCD, which is fast to compute. The LCM is especially useful for finding common denominators when adding or subtracting fractions.
Relationship to factors
The LCM of a set of numbers incorporates all of their prime factors, taken at the highest power that appears in any of the numbers. For instance, and , so .
This connects to a fundamental identity:
This relationship isn't just a formula to memorize. It tells you that the LCM and GCD together account for all the prime factor "information" in both numbers, with no overlap.
LCM vs GCD
LCM and GCD go in opposite directions. The GCD finds the largest factor shared by the numbers, while the LCM finds the smallest multiple they share. As numbers get larger, their LCM tends to grow (or stay the same), while their GCD tends to shrink (or stay the same).
A useful way to think about it: GCD strips away everything that isn't shared, while LCM combines everything from both numbers. If two numbers are coprime (), their LCM is simply their product.
Finding LCM
Three standard methods exist for computing LCM. Which one you reach for depends on the size of the numbers and the context.
Prime factorization method
- Decompose each number into its prime factorization.
- For each prime that appears in any factorization, take the highest power.
- Multiply those highest powers together.
Example: Find .
- Take the highest powers:
This method is clean and reliable, but it requires you to factor the numbers first, which can be slow for large integers.
Division method (ladder method)
- Write the numbers side by side.
- Find the smallest prime that divides at least one of the numbers. Divide whichever numbers it divides, and bring down the rest unchanged.
- Repeat until every number has been reduced to 1.
- Multiply all the primes you divided by.
Example: Find .
| Prime | 12 | 18 |
|---|---|---|
| 2 | 6 | 9 |
| 2 | 3 | 9 |
| 3 | 1 | 3 |
| 3 | 1 | 1 |
This is particularly handy when working with three or more numbers at once.
Listing multiples method
Write out the multiples of each number until you spot the first one they share.
- Multiples of 4: 4, 8, 12, 16, 20, ...
- Multiples of 6: 6, 12, 18, 24, ...
- First common multiple: 12
This is the most intuitive approach and works well for small numbers or mental math, but it becomes impractical as numbers grow.
Properties of LCM
These properties aren't just trivia. They're what let you manipulate LCM expressions in proofs and extend LCM calculations to more than two numbers.
Commutative property
The order doesn't matter:
This extends to any number of inputs: , etc.

Associative property
Grouping doesn't matter:
This is what lets you compute the LCM of a long list of numbers by processing them two at a time, in any order.
Distributive property
LCM distributes over GCD:
This property mirrors how multiplication distributes over addition, and it reveals a deep structural connection between LCM and GCD. Together, they form a lattice on the positive integers, which becomes important in abstract algebra.
Applications in mathematics
Fraction arithmetic
The most common everyday use of LCM is finding a common denominator. To add , you need :
Using the LCM (rather than just any common multiple) keeps the numbers as small as possible, which reduces the chance of arithmetic errors and minimizes simplification at the end.
Problem-solving scenarios
LCM naturally models situations where multiple cycles need to sync up:
- Scheduling: Two bus routes with cycles of 15 and 20 minutes both depart at 8:00 AM. They'll next depart together in minutes, at 9:00 AM.
- Gear teeth / rotating systems: If two gears have 12 and 18 teeth, they return to their starting alignment after teeth have passed.
- Packaging: You need to buy hot dogs (packs of 8) and buns (packs of 6) with none left over. You need of each.
Algebraic manipulations
LCM extends to algebraic expressions. To add , you find and rewrite:
The same principle applies when solving equations with fractional coefficients: multiply through by the LCM of the denominators to clear all fractions at once.
LCM and number theory
Connection to prime numbers
The prime factorization method for LCM works because of the Fundamental Theorem of Arithmetic: every integer greater than 1 has a unique prime factorization. Without unique factorization, the "take the highest power of each prime" recipe wouldn't be well-defined.
The behavior of LCM across ranges of integers also connects to deeper questions about prime distribution. For example, grows roughly like as gets large, a fact tied to the Prime Number Theorem.
Role in modular arithmetic
LCM determines when periodic patterns re-sync. If one event repeats every steps and another every steps, they coincide every steps.
This idea is central to the Chinese Remainder Theorem (CRT): a system of congruences and has a solution modulo (provided the congruences are compatible). When the moduli are coprime, , and a unique solution is guaranteed.

LCM in Diophantine equations
For a linear Diophantine equation like , integer solutions exist if and only if divides . The LCM enters when you look at the spacing between solutions: consecutive solutions for differ by , and the overall structure of the solution set ties back to the LCM-GCD identity.
Computational aspects
Algorithms for LCM calculation
The standard approach computes LCM via GCD:
So the efficiency of LCM computation reduces to the efficiency of GCD computation. The main algorithms:
- Euclidean algorithm: Repeatedly replace the larger number with the remainder of dividing the two. Fast and simple.
- Binary GCD (Stein's algorithm): Replaces division with bitwise shifts and subtraction, which can be faster on hardware that handles binary operations efficiently.
Both run in steps for the basic Euclidean algorithm, making LCM computation very efficient even for large numbers.
Efficiency considerations
One practical concern: computing before dividing by the GCD can cause overflow for large integers. A safer approach is to divide first: . Since divides , the intermediate result stays smaller.
For computing the LCM of many numbers, apply the associative property and process them pairwise: .
LCM in programming languages
Most modern languages provide LCM either directly or through their GCD function:
- Python 3.9+:
math.lcm(a, b)(also accepts multiple arguments) - Python (any version):
abs(a * b) // math.gcd(a, b) - C++17:
std::lcm(a, b)in<numeric>
These built-in functions handle edge cases like zero inputs ( by convention) and negative numbers.
Advanced topics
LCM of polynomials
The LCM concept extends naturally to polynomials. Just as with integers, you factor each polynomial, then take the highest power of each irreducible factor.
Example: For and :
This is essential when adding rational expressions (algebraic fractions) with polynomial denominators.
LCM in abstract algebra
In a ring, the LCM of two elements and is an element such that and , and divides every other common multiple. This doesn't always exist in arbitrary rings, but it does in unique factorization domains (UFDs) and principal ideal domains (PIDs).
In the language of ideals, corresponds to the intersection of ideals: in a PID. Compare this with GCD, which corresponds to the sum of ideals: .
Generalizations to other structures
The pattern of LCM and GCD generalizes to any lattice: a partially ordered set where every pair of elements has a least upper bound (join, analogous to LCM) and a greatest lower bound (meet, analogous to GCD). The positive integers ordered by divisibility form one such lattice, but the same framework applies to sets ordered by inclusion, subgroups ordered by containment, and many other structures across mathematics.