How this calculator works
The Euclidean algorithm finds the GCD without enumerating factors. LCM is built pairwise by dividing out the GCD before multiplying. Signs are ignored. The calculation rejects an LCM above 9,007,199,254,740,991 so its integer result remains safely representable in the response.
The formula
GCD(a,b) = GCD(b,a mod b)
LCM(a,b) = |(a/GCD(a,b)) × b|
If either number is zero, LCM is zero.
A quick example
For 12 and 18, the greatest common divisor is 6 and the least common multiple is 36.
How to use this calculator
- Enter 2–10 integers separated by spaces, commas or new lines.
- Use plain integers rather than decimal or exponential notation.
- Calculate GCD and LCM; reduce input magnitudes if the exact-result limit is exceeded.