Math

LCM Calculator

Least common multiple by Euclid: the gcd first, the divide-first product order, and the a × b = gcd × lcm identity printed as a live check.

LCM Calculator

Results recalculate instantly on every keystroke. Nothing you type is transmitted.

The two numbers
LCM
—
Euclid for the gcd—
The identity check—
Note—

What this result does not account for

  • Two integers per run — compose pairs for three or more
  • Positive whole numbers only; zero refused as trivial
● Zero-Server Execution Updated 11 Aug 2026 Reviewed by Sana Khalid IEEE-754 Double Precision

In short: lcm(4, 6) = 12 — Euclid hands you the gcd 2 (6 = 1×4 + 2, then 4 = 2×2 + 0) and the identity finishes it: 4 × 6 = 24 = 2 × 12. When the gcd is 1 the pair is coprime and the lcm is the product itself: 4 and 9 give 36 with nothing to cancel.

Formula

gcd by Euclid → lcm = (a/gcd) × b

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

dividing BEFORE multiplying keeps every intermediate inside the integers.

Worked Example

  1. Euclid. run a mod b until it lands on zero — the last non-zero remainder is the gcd.
  2. Divide first. lcm = (a ÷ gcd) × b — the division happens while the numbers are small, which is also how overflow is avoided in code.
  3. Check. print the identity: a × b must equal gcd × lcm. If it does, the arithmetic is self-witnessed.

The identity is the page’s proof: 4 × 6 = 24 and 2 × 12 = 24 — the same 24 counted two ways. On a coprime pair (gcd 1) nothing cancels and lcm = a × b directly.

Strengths & Limits Of This Model

Where this engine is strong

  • Euclid lines printed — the gcd is auditable, not asserted
  • Divide-first order, the same habit overflow-safe code uses

Where it stops

  • No factor-tree view
  • No lcm of a whole list in one shot

Risk & accuracy notice. The lcm answers “when do these cycles coincide” and nothing else. It does not tell you whether coincidence is likely, only when it is first possible; treating the first common multiple as a prediction about real events adds assumptions this page does not make.

Practical Use Cases

Alarms and orbits

two cycles next ring together at the lcm

Fraction addition

the common denominator is the lcm of the two denominators

Repeating schedules

trash day and recycling day line up on the lcm

Methodology & Editorial Standards

Euclid on (a, b): repeat a mod b until zero; the last non-zero remainder is g. Then lcm = (a/g) × b in integer arithmetic, and the identity a × b = g × lcm is recomputed and printed as a self-check. Both operands must be whole numbers of at least 1.

Computation runs in IEEE-754 double precision at full internal precision; rounding to two decimal places occurs strictly at the display layer, so no cumulative drift enters the result. All monetary outputs use accounting presentation — grouped thousands, two decimals, negatives in parentheses — so figures can be transcribed directly into a model or working paper. Division-by-zero and out-of-domain inputs return an em-dash rather than a misleading number.

This engine was reconciled against an independent reference implementation and hand-verified for the worked example above before release. Our full five-stage review process is published on the About Us page.

Sana Khalid Principal Front-End Engineer · ApexConverter

Numerical methods and floating-point precision engineering. Last reviewed: 11 August 2026.

Disclaimer. This calculator is provided for informational and modelling purposes only and does not constitute financial, tax, legal, medical, or engineering advice. Verify all figures with a qualified professional before acting on them.


LCM Calculator — 9 Expert FAQs

9 analyst-written answers to the questions practitioners actually ask — optimised for voice and answer-engine retrieval.

What does the LCM actually mean?

The smallest number both inputs divide. It is the first moment two cycles coincide: alarms of 4 and 6 minutes ring together at minute 12 and not before. Multiples of 4 are 4, 8, 12, 16, … and multiples of 6 are 6, 12, 18, … — 12 is the first name on both lists.

Why compute the gcd first instead of listing multiples?

Listing works for toy numbers and collapses for real ones — the lcm of 1,029 and 1,071 is not something you want to find by listing. Euclid reaches their gcd (21) in a handful of remainders, and the identity hands over the lcm (52,431) instantly. The identity makes the hard case easy; listing only ever worked by luck.

Why divide by the gcd BEFORE multiplying by b?

Order is a correctness habit, not a style. a/gcd is always a whole number, so (a/gcd) × b never touches a fraction; and in code where numbers have limits, dividing first keeps every intermediate value as small as the answer itself. Multiply-first computes the same value with a needlessly large middle step.

What happens when the gcd is 1?

The pair is coprime — nothing cancels — and the identity says lcm = a × b outright. 4 and 9 share no factor, so their lcm is 36, the full product. This is also why distinct primes always give a product-shaped lcm.

Is lcm(0, n) really refused? Some tables say 0.

Some conventions define lcm(0, n) = 0 and leave it there. This page refuses instead: zero divides nothing, the multiple ladder for 0 is just 0, 0, 0, and the identity a × b = gcd × lcm turns 0 = gcd(0, n) × lcm into a statement about nothing. A tool that answers every zero question with 0 is not answering.

How is this different from the GCF page?

They are the two ends of one see-saw. The gcd is the largest number dividing BOTH inputs — it lives below them; the lcm is the smallest number both inputs divide — it lives above them. The identity nails the two together: their product is always a × b. This page computes the gcd only as scaffolding for the lcm; the GCF page does the reverse.

Does the page work for three or more numbers?

Two at a time, honestly. The ladder generalizes — lcm(a, b, c) = lcm(lcm(a, b), c) — but a three-input page hides which pair contributed the bulk. Run the pairs and the composition is visible: the lcm of 4, 6 and 9 is lcm(lcm(4, 6), 9) = lcm(12, 9) = 36.

Why does the Euclid card print remainders I did not ask for?

Because the gcd is the engine of the whole answer, and Euclid is how the page gets it: each line a = q × b + r is one round of “divide, keep the remainder”, and the last non-zero remainder is the gcd. Printing the lines lets you audit the scaffolding — 6 = 1×4 + 2, 4 = 2×2 + 0 — instead of trusting a bare 2.

Can I use negative numbers?

No — multiples live on the positive ladder. The mathematical convention takes lcm of absolute values, so the sign is decoration; the page asks for the positives directly and keeps every printed line inside the ladder the multiples actually form.

Related Math Engines