MATH CALCULATOR

GCD and LCM Calculator

Enter two integers or paste a list to find their greatest common divisor and least common multiple. Inspect exact Euclidean division steps and whether the entire group has GCD one.

Calculator

Pair and list entries are retained independently.
Enter 2–20 integers within ±1 trillion, separated by spaces, commas, semicolons or newlines.
YOUR RESULTS
Greatest common divisor12
Least common multiple
720
GCD equals one?
No

2 integer magnitudes were combined exactly. GCD equal to one means no factor above one divides the entire group; for three or more entries this does not mean every pair is coprime.

Euclidean division steps
Euclidean division steps
CombinationExact division identityRemainder
Combine integer 248 = 0 × 180 + 4848
Combine integer 2180 = 3 × 48 + 3636
Combine integer 248 = 1 × 36 + 1212
Combine integer 236 = 3 × 12 + 00
Page guide

Common divisor and multiple for the integer group

GCD is the largest positive integer dividing every entered magnitude. LCM is the smallest positive shared multiple for nonzero entries, defined here as zero if any entry is zero. GCD equals one means no factor above one divides the entire group. For two entries this is coprimality; for a longer list it does not prove that each pair is coprime.

The formula

gcd(a, b) = gcd(b, a mod b); lcm(a, b) = |a ÷ gcd(a, b) × b|

The Euclidean algorithm repeatedly replaces the pair with the second value and the division remainder. The last nonzero divisor is the GCD. Signs are removed before calculation. With exactly one zero input, the GCD is the magnitude of the nonzero input and the LCM is defined here as zero. For a list, fold GCD and LCM over each next integer. The table records Euclidean divisions used to update the common GCD. Exact BigInt arithmetic keeps the full LCM product even when it exceeds ordinary floating-point integer precision.

Common divisors of 48 and 180

The remainders are 180 mod 48 = 36, 48 mod 36 = 12, and 36 mod 12 = 0. The GCD is 12. Dividing 48 by 12 and multiplying by 180 gives an LCM of 720.

How to use this calculator

  1. Choose Two integers or List of integers; use whole numbers within ±1 trillion.
  2. In list mode enter 2–20 values separated by commas, semicolons, whitespace or newlines. At least one value must be nonzero.
  3. Review live exact GCD/LCM and expand Euclidean steps. Interpret GCD equals one as a group result.

Reducing fractions and matching cycles

Dividing a fraction’s numerator and denominator by their GCD puts it into lowest terms. For example, 48/180 reduces to 4/15 after dividing both by 12. The value of the fraction does not change.

The LCM can identify a shared interval for two regular integer-length cycles that begin together. Cycles of 48 and 180 units align again after 720 units under that exact periodic model.

Zero, signs, and large products

A negative sign does not change which positive integers divide a number, so the results are nonnegative. Both zero inputs are rejected because there is no greatest positive divisor of zero and zero together.

The product of two accepted integers may exceed the range that ordinary decimal display arithmetic can represent exactly. This calculator keeps the entire Euclidean calculation and final product in integer arithmetic, then displays the complete result as text.

A common group factor is different from pairwise factors

For 6, 10 and 15 the common GCD is one and the LCM is 30. Yet 6 and 10 share 2, 6 and 15 share 3, and 10 and 15 share 5. The group GCD-one result must not be read as pairwise coprimality. In two-number mode the same result means that the pair is coprime.

Assumptions & limitations

What this calculation assumes

  • Each input is an integer between −1 trillion and 1 trillion.
  • At least one entered integer is nonzero.

What to keep in mind

  • List mode accepts 2–20 integers and at most 400 characters; decimals and scientific notation in the list are rejected.
  • Cycle interpretations assume exact periods and a shared starting point; calendar months are not fixed-length periods.

Common questions

Are GCD and greatest common factor the same?

Yes. GCD, GCF, and highest common factor refer to the same positive divisor.

Can the LCM be smaller than an input?

For two nonzero positive inputs it cannot be smaller than either one. The zero-input convention is a separate boundary case.

Does coprime mean both numbers are prime?

No. For example, 8 and 9 are both composite but share no divisor greater than one, so they are coprime.

Can I paste more than two numbers?

Yes. Choose List of integers and enter 2–20 whole values with spaces, commas, semicolons or newlines. All signs are removed for positive-divisor and multiple results.

Sources & further reading

Reviewed on