What the LCM Calculator Does
The LCM Calculator finds the Least Common Multiple of a set of whole numbers — the smallest positive integer that every number you enter divides into evenly. It accepts a list of integers in a single field and returns one result: their combined LCM. This is handy for adding fractions with different denominators, scheduling repeating events, and solving number-theory problems.
How to Use It
- Numbers — type two or more integers into the input box.
- Separate them with commas, semicolons, or spaces — the calculator splits on commas (both English and full-width), semicolons, and any whitespace.
- Negative integers are accepted; only valid whole numbers (matching the pattern
-?\d+) are kept, so stray text is ignored.
For example, entering 4, 6, 8 is read as the list [4, 6, 8].
The Formula Explained
For two numbers the calculator uses the classic relationship between LCM and the Greatest Common Divisor (GCD):
$$\text{LCM}(a, b) = \frac{|a \cdot b|}{\gcd(a,\,b)}$$
When you supply more than two numbers, it folds the operation across the list — computing the LCM of the first two, then taking the LCM of that result with the next number, and so on. In code terms this is a reduce/inject: LCM(a, b, c) = LCM(LCM(a, b), c).
Worked Example
Suppose you enter 4, 6, 8:
- Step 1: \(\gcd(4, 6) = 2\), so $$\text{LCM}(4, 6) = \frac{4 \times 6}{2} = \frac{24}{2} = 12.$$
- Step 2: \(\gcd(12, 8) = 4\), so $$\text{LCM}(12, 8) = \frac{12 \times 8}{4} = \frac{96}{4} = 24.$$
The calculator returns 24 — the smallest number that 4, 6, and 8 all divide into evenly.
Frequently Asked Questions
Can I enter more than two numbers? Yes. There is no fixed limit — the tool processes the entire list and applies the LCM pairwise until a single answer remains.
What happens with negative numbers? Negatives are allowed and parsed correctly. Because the formula uses the absolute value of the product, the LCM is always reported as a positive integer.
What if I include letters or symbols? Non-numeric tokens are filtered out automatically. Only entries matching a valid integer pattern are used, so 4, x, 6 is treated the same as 4, 6.