LCM (Least Common Multiple) Calculator
lcm(a,b) = |a ร b| / gcd(a,b). Smallest number that both a and b divide evenly.
Result
General calculation reads
Amazon affiliateAs an Amazon Associate we may earn from qualifying purchases. This does not add cost for you.
How to use this calculator
- Enter 2-4 positive integers.
- Leave optional fields at 0 to ignore.
About this calculator
The LCM (least common multiple) is the smallest positive integer that is a multiple of all the inputs. Computed via gcd: lcm(a,b) = |a ร b| / gcd(a,b). For more than 2: associative โ lcm(a,b,c) = lcm(lcm(a,b),c). Common use: adding fractions (find common denominator), scheduling cycles that synchronize, music time signatures. lcm(12, 18) = 36 โ same as 12 ร 3 = 36 = 18 ร 2.
How it works โ the formula
lcm(a, b) = (|a ยท b|) / gcd(a, b)
lcm(aโ, aโ, โฆ, aโ) โ apply pairwiseThe least common multiple of two integers is the smallest positive integer that both divide. The product-quotient identity above lets any LCM calculation reduce to a GCD calculation, which Euclid's algorithm handles in O(log min(a,b)). For more than two integers, the LCM is associative and can be computed pairwise: lcm(a,b,c) = lcm(lcm(a,b), c).
Worked examples
- Inputs:
- a = 4, b = 6
- Output:
- |4ยท6| / gcd(4,6) = 24 / 2 = 12
- Inputs:
- a = 35, b = 8
- Output:
- gcd = 1 โ lcm = |35ยท8| / 1 = 280
- Inputs:
- lcm(4, 6, 8)
- Output:
- lcm(4,6) = 12; lcm(12, 8) = 24
Limitations
- lcm(a, 0) = 0 by convention (zero is a multiple of every integer).
- Computes positive LCM; sign of inputs is ignored via the |ยท| in the identity.
- For very large integers (above 2โตยณ), use BigInt to avoid floating-point precision loss.
- For real or polynomial domains, generalise via the appropriate Euclidean ring rather than this formula.
Implementation reduces to GCD via the product identity; result exact for inputs within the safe-integer range.
Frequently asked
When is LCM useful?+
Why divide by gcd?+
LCM of coprime numbers?+
Negative numbers?+
LCM of 0?+
Related calculators
More tools you might like
Hand-picked tools that pair well with this one โ same audience, same intent.
Euclidean algorithm: gcd(a,b) = gcd(b, a mod b). Supports 2-6 integers.
Is n prime? Trial division up to โn; identifies smallest divisor and nearest primes if composite.
n! = 1 ร 2 ร โฆ ร n. Computes exactly up to 21! (number limit); approximate via Stirling for larger.
n = pโ^aโ ร pโ^aโ ร โฆ Trial division to find all prime factors with multiplicity.
Convert decimal โ scientific notation. Standard form a ร 10^b with 1 โค |a| < 10.
Combine multiple PDF pages onto one output sheet โ 2-up, 4-up, 6-up, or 9-up. Pages are scaled-to-fit with proportional margins; great for drafts, handouts, or thumbnail review.