MATH CALCULATOR

GCD and LCM Calculator

Enter two integers to find their greatest common divisor, least common multiple, and whether they are coprime.

Calculator

YOUR RESULTS
Greatest common divisor12
Least common multiple
720
Coprime?
No

Understanding your result

The greatest common divisor, also called the greatest common factor, is the largest positive integer dividing both inputs without a remainder. The least common multiple is their smallest positive shared multiple when both inputs are nonzero. A pair is coprime exactly when its GCD is one.

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.

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. Enter two whole numbers, including a minus sign if needed.
  2. Calculate to read the GCD and LCM as exact integers.
  3. Use the coprime result to check whether any factor greater than one is shared.

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.

Assumptions & limitations

What this calculation assumes

  • Each input is an integer between −1 trillion and 1 trillion.
  • At least one of the two integers is nonzero.

What to keep in mind

  • Only two integers are accepted at a time.
  • 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.

Sources & further reading