LCM Calculator
Find the LCM or LCD of two or more integers, including exact 48-digit inputs. Compare methods, read full working, and share or export results. Free, no sign-up.
Enter values to calculate.
Trust summary CVP VERIFIED · CVP protocol 1.0.0-proposed · Core assurance
- Input interpretation
- Enter values to calculate.
- Result
- —
- Assurance
- Core
- Declared partition coverage
- PASS · 8/8 declared partitions (lcm, zero, negative, beyond-safe-integer, multi-input-fold, method-unavailable, xcal, invalid-domain) · Matrix
- Known limitations
- 2–32 signed integers,48 digits each, strict matching aliases, complete exact result/work; any zero→0; bounded listing and prime checks
- Core CVP does not include live graph, viewport, or pointer interaction.
- Model
- LCM of two or more integers, with listing, prime-power, and GCF-identity steps and method agreement when listing is feasible.
- Scope
- Integer inputs; negatives treated by absolute value.
- Verification
- Engine tested · Source checked · v1.0.4 · CVP VERIFIED · CVP protocol 1.0.0-proposed · Core assurance· View Manifest · CVP overview · Specification
- Versions
- Calculation 1.0.4 · CVP protocol 1.0.0-proposed · Evidence 2026-10-21.lcm-complete-contract-v2
- Verification revision
- 2026-10-21.lcm-complete-contract-v2 · 3/3 property · digest f87d285d6b3e
- Legacy regression
- 20/20 tests · Production surface contract 6/6
- Trust layers
- Verification VERIFIED · Production CURRENT · Overall CVP state: VERIFIED under CVP 1.0.0-proposed
- Reference
- O1 model · O2 expected_values · O2 numerical_behavior
- Interfaces
- PASS · UI (SSR) / REST / MCP
- Supplemental domain review
- Not performed
- Named expert review
- Not performed
- CVP suite
- 9/9 golden · 7/7 CVP boundary · 3/3 invalid · 3/3 property · 1/1 metamorphic · 1/1 cross-interface · 5/5 cross-calculator · 6/6 CVP contract · Manifest
- Sources
- Encyclopedia of Mathematics — Least common multiple
- Python math.lcm — zero convention
- CalculatorX integer convention
- MIT Mathematics for Computer Science — Chapter 8: Number Theory
- Methods
- Pairwise GCF-identity fold (canonical engine; divide before multiply)
- Prime-factor LCM (cross-check when every |n| ≤ 1,000,000 and none is 0)
- Listing multiples (cross-check when LCM ≤ 5,000 and every |n| ≤ 500)
- Evidence
- 6 legacy golden · 7 legacy boundary · legacy regression suite · 9/9 oracle-backed golden · 3/3 invalid · Artifact integrity PASS
- Semantic contract
- PASS
Full verification
Formulas
Core equations used by this calculator.
How to use
Enter two or more integers
Separate with commas or spaces (e.g. 8, 12 or 10 12 15 75). Negatives use absolute value.
Calculate
Read the LCM plus listing, prime-power, and GCF-identity working when the values are small enough to list.
Use with fractions
If the inputs are denominators, the LCM is their least common denominator (LCD).
Example calculations
Common configurations with formula and result.
Two numbers
8 and 12
Via GCF
GCF(6,10) = 2
Three numbers
21, 14, 38
Prime powers
12, 18, 30
With zero
LCM(0, 5)
Quick checks
Common values at a glance.
| Numbers | LCM |
|---|---|
| 8, 12 | 24 |
| 6, 10 | 30 |
| 12, 30 | 60 |
| 6, 7, 21 | 42 |
| 21, 14, 38 | 798 |
| 12, 18, 30 | 180 |
| 10, 12, 15, 75 | 300 |
| 0, 5 | 0 |
| 0, 12, 18 | 0 |
LCM calculator specification
Version 1.0.4 · Engine tested
- Engine tested 20/20 tests · Production surface contract 6/6
- Named expert review Not performed
- Calculation version 1.0.4
- Definition
- For nonzero integer inputs, the least common multiple (LCM), also called lowest common multiple, is the smallest positive integer divisible by every input. Under CalculatorX's zero convention, if any input is 0, the LCM is 0. When the integers are denominators, the LCM is the least common denominator (LCD). Enter two or more integers separated by commas or spaces. Negative values are treated by absolute value.
- What it calculates
- LCM of two or more integers, with listing, prime-power, and GCF-identity steps and method agreement when listing is feasible.
- Inputs
- Two or more integers (comma- or space-separated). Share-URL field: numsInput. REST aliases: values, numbers.
- Outputs
- LCM: positive when every input is nonzero; 0 if any input is 0 (JSON number when it fits IEEE-754 safe integers; otherwise the exact decimal string)
- Sample multiples lists (when LCM ≤ 5,000 and every |n| ≤ 500)
- Prime factorization / highest powers (when every |n| ≤ 1,000,000 and none is 0)
- GCF identity steps
- Method agreement (listing / prime / GCF)
- Formula
LCM(a,b,c,…) = LCM(LCM(a,b),c,…); LCM(a,b)=|a/GCF(a,b)×b|- Assumptions
- Integer inputs; negatives treated by absolute value.
- If any input is 0, LCM = 0. LCM(0,0)=0 is a CalculatorX/Python convention, not a GCF-identity derivation.
- For nonzero inputs the result is a positive integer.
- Units
- Dimensionless (integers)
- Boundary conditions
- Need at least two numbers → NEED_TWO_NUMBERS
- Missing list → MISSING_REQUIRED_INPUT
- Non-integers rejected → INVALID_NUMBER
- More than 48 digits → VALUE_ABOVE_MAX
- Any zero → LCM = 0
- Numerical precision
- Interactive calculation uses exact BigInt locally: pairwise LCM fold LCM(a,b)=|a/GCF(a,b)×b| (divide first).
- Shareable URLs (?numsInput=8,12) are server-rendered with the same deterministic engine so crawlers and no-JS clients see the same result.
- REST and SSR return { values, value, exact, count, formula, binary_formula, methods, work, max_digits }. value is a JSON number when it fits in IEEE-754 safe integers, otherwise the exact decimal string.
- Integers beyond MAX_SAFE_INTEGER must be sent as decimal strings so JSON number rounding cannot change them.
- The 48-digit cap is a CalculatorX product bound, not a mathematical bound.
- Example
- LCM(8,12)=24; LCM(0,5)=0; LCM(9007199254740993, 3)=9007199254740993
- Validation cases
7 published on this page · 20/20 tests · Production surface contract 6/6 · View evidence
- 8, 12 → 24
- 6, 10 → 30
- 21, 14, 38 → 798
- 12, 18, 30 → 180
- 10, 12, 15, 75 → 300
- 0, 5 → 0
- 9007199254740993, 3 → 9007199254740993
- Methods
- Pairwise GCF-identity fold (canonical engine; divide before multiply)
- Prime-factor LCM (cross-check when every |n| ≤ 1,000,000 and none is 0)
- Listing multiples (cross-check when LCM ≤ 5,000 and every |n| ≤ 500)
- Sources
- Encyclopedia of Mathematics — Least common multiple — Definition; pairwise fold; relation to GCDSupports: LCM of n integers via pairwise fold; lcm(a,b)·gcd(a,b)=|ab| for nonzero a,b
- Python math.lcm — zero convention — If any argument is zero, LCM = 0Supports: Any zero argument → 0; LCM(0,0)=0 is that convention, not |a/GCF(a,b)×b| (Python separately defines gcd(0,0)=0; the division identity is not used here)
- CalculatorX integer convention — Absolute value; 48-digit BigInt domain; divide-first identitySupports: Negatives by |n|; exact BigInt with a product digit cap; LCM(a,b)=|a/GCF(a,b)×b|
- MIT Mathematics for Computer Science — Chapter 8: Number Theory — Chapter 8, including sections 8.2–8.9 and problem 8.24Supports: Divisibility, prime factorization, gcd and the Euclidean algorithm, lcm via prime exponents, division with remainder, modular congruence and multiplicative inverses. CalculatorX’s signed-remainder and zero-input policies are stated separately on the page. Mathematical reference only; not validation or endorsement of this implementation.
- Encyclopedia of Mathematics — Least common multiple — Definition; pairwise fold; relation to GCD
- Calculation version
- 1.0.4
Background
Interpretation and common distinctions.
What does this lcm calculator compute?
For nonzero integer inputs, the least common multiple (LCM), also called lowest common multiple, is the smallest positive integer divisible by every input. Under CalculatorX's zero convention, if any input is 0, the LCM is 0. When the integers are denominators, the LCM is the least common denominator (LCD). Enter two or more integers separated by commas or spaces. Negative values are treated by absolute value.
The published formula or method is LCM(a,b,c,…) = LCM(LCM(a,b),c,…); LCM(a,b)=|a/GCF(a,b)×b|. The following references support the stated mathematics or method:
- MIT Mathematics for Computer Science — Chapter 8: Number Theory: Divisibility, prime factorization, gcd and the Euclidean algorithm, lcm via prime exponents, division with remainder, modular congruence and multiplicative inverses. CalculatorX’s signed-remainder and zero-input policies are stated separately on the page. Mathematical reference only; not validation or endorsement of this implementation.
Which inputs and limits should you check?
Follow the input domain, units, branch or solve direction, and rounding policy in the specification. Preserve exact outputs and any additional candidates or warnings.
The worked example uses 8 and 12 with multiples meet at 24. Compare it with the Example calculations and the complete result for the same inputs.
How can you verify and cite this result?
CalculatorX is responsible for this page. The mathematical references above explain the model; implementation checks and their scope are documented separately in the math.lcm v1.0.4 Evidence and capability contract. Read the displayed verification and production state together with the specification's numerical limits.
Use the clean calculator URL to cite the tool. A shared input link identifies a particular calculation. Content updates, numerical verification, and domain reviews have separate dates and scopes.
What is the LCM?
For nonzero integers, the least common multiple (also lowest common multiple) is the smallest positive integer divisible by each of them.
LCM(a,b,c,…)=LCM(LCM(a,b),c,…)
Negative inputs use absolute value. Under CalculatorX’s zero convention, if any input is 0 the LCM is 0. If those integers are denominators, the LCM is the least common denominator (LCD) used to add or subtract fractions.
Methods
Listing multiples
List positive multiples until a common value appears.
LCM(6, 7, 21): multiples of 6 include 42; of 7 include 42; of 21 include 42 → 42.
Prime factorization
Take each prime to the highest power that appears in any number, then multiply.
LCM(12, 30): 12=2²×3, 30=2×3×5 → 2²×3×5=60.
LCM(12, 18, 30): 2²×3²×5=180.
GCF identity
Divide by the GCF first so the intermediate product stays smaller:
LCM(a,b)=|a/(GCF(a,b))× b|
LCM(6, 10): GCF(6,10)=2 → (6/2)×10=30. This identity requires a nonzero GCF, so it applies when at least one argument is nonzero.
For three or more numbers, compute pairwise (order does not matter if done consistently). When the values are small enough to list, the page shows listing, prime powers, and the GCF identity and reports whether they agree.
LCM and zero
- If any input is 0, LCM=0.
- For a zero/nonzero pair, the GCF identity yields 0: GCF(0,5)=5, so |(0/5)×5|=0.
- For (0,0), GCF is undefined in CalculatorX; the identity is not evaluated because |a/GCF(a,b)× b| would divide by zero. CalculatorX explicitly defines LCM(0,0)=0, matching Python
math.lcm. Some textbooks leave LCM(0,0) undefined.
Integer range
Calculation uses exact BigInt, so integers larger than Number.MAX_SAFE_INTEGER stay exact. Use 2–32 integers; each input may have at most 48 decimal digits (a product bound, not a mathematical bound). Values beyond the IEEE-754 safe integer range must be sent to the API as decimal strings.
Example: LCM(9007199254740993, 3)=9007199254740993.
Agent / API notes
Capability id: math.lcm · tool id: lcm · pin calculation_version: 1.0.4.
POST /api/v1/calc/lcm
{ "inputs": { "values": [8, 12] } }
Share URL: /calc/math/lcm?numsInput=8,12. Aliases: numbers, numsInput.
Aliases must describe the same ordered list; explicit empty input is an error. List strings are bounded to4096 characters, array token strings to128; whitespace/comma/semicolon separators are accepted. Integers beyond the safe JSON number range require decimal strings; leading zero digits count toward the48-digit bound. Unknown fields are rejected. Results can reach1536 digits. Listing checks use inputs≤500 and LCM≤5000; each displayed row stops at80 multiples with an omission note. Prime checks use inputs≤1000000; GCF identity always applies with the explicit zero branch.
Stable error codes: MISSING_REQUIRED_INPUT, NEED_TWO_NUMBERS, INVALID_NUMBER, VALUE_ABOVE_MAX, INPUT_TOO_LARGE, TOO_MANY_VALUES, INPUT_ALIAS_CONFLICT, UNKNOWN_INPUT.
Precision and data paths
BigInt results are exact for the accepted normalized integer list. JSON numeric literals first use binary64 and may already have rounded near an integer; send exact decimal strings to preserve original integers. Nonzero raw JSON underflow is rejected. Decimal/exponent/hex strings and fractional inputs are not integers in this contract.
Interactive arithmetic runs locally. Share URLs send their parameters to the server and may enter request logs; REST/MCP also send inputs. Browser history may retain up to20 result snapshots on this device; Clear empties this form, not stored history. Analytics may load conditionally; retention, deletion and processing region are not established by this review. CVP and method agreement are not third-party certification.
Related tools
Other calculators in this family: Arithmetic Sequence Calculator, Factorial Calculator, Fibonacci Calculator, GCF Calculator, Geometric Sequence Calculator, Modular Inverse Calculator, Modulo Calculator, Permutation Combination Calculator . Explore all Number Theory & Discrete Math.
Frequently asked questions
Key distinctions behind the calculation.
What is the least common multiple?
For nonzero integers it is the smallest positive integer evenly divisible by each input. Also called lowest common multiple. If any input is 0, CalculatorX returns 0. If the inputs are denominators, that value is the LCD.
How do I find LCM by listing multiples?
List positive multiples of each number until a shared value appears; the smallest positive shared multiple is the LCM.
How does prime factorization give the LCM?
Factor each nonzero number into primes. For every prime, take the highest exponent that appears in any factorization, then multiply those prime powers.
How is LCM related to GCF?
For two integers, LCM(a,b)=|a/GCF(a,b)×b|. The engine divides by GCF first so the intermediate product stays smaller. For more numbers, fold pairwise: LCM(a,b,c)=LCM(LCM(a,b),c).
Is LCD the same as LCM?
LCD means least common denominator — the LCM of the denominators when adding or subtracting fractions. LCM of 8 and 12 is 24; 24 is the LCD only if 8 and 12 are used as denominators.
What about LCM with 0?
If any input is 0, LCM = 0. For a zero/nonzero pair such as LCM(0,5), the GCF identity yields 0 because GCF(0,5)=5 and |(0/5)×5|=0. For (0,0), GCF is undefined in CalculatorX, so the identity is not evaluated; CalculatorX explicitly defines LCM(0,0)=0, matching Python math.lcm. Some textbooks leave LCM(0,0) undefined.
Do you accept negative integers?
Yes. Negatives are treated by absolute value, so LCM(−8, 12) = 24.
How large can the integers be?
Each integer may have at most 48 decimal digits. Arithmetic uses exact BigInt, so values larger than JavaScript’s MAX_SAFE_INTEGER (9,007,199,254,740,991) stay exact — for example LCM(9007199254740993, 3) = 9007199254740993.
Can I enter decimals?
This tool expects integers. To handle decimals, scale them to integers (same number of decimal places), find the integer LCM, then scale back.