Math

GCD and LCM calculator

Enter two or more integers and get the greatest common divisor, least common multiple, verification and step-by-step work.

Numbers

Separate with commas, spaces or line breaks. Only integers.

Calculation

Examples

GCD steps
  1. Complete a valid list to view the steps.
LCM steps
  1. Complete a valid list to view the steps.
Prime factors
  • Prime factorization will appear with a valid list.

By prime factors

GCD: -

LCM: -

Publicidad

Worked examples

Common cases for practicing GCD, LCM, zeros and coprime numbers.

12, 18, 30

Common case with clear GCD and LCM.

12, 18, 30

8, 12, 15

Common denominators when finding a common denominator.

8, 12, 15

42, 56

Two numbers with a common divisor.

42, 56

7, 13

Coprime numbers.

7, 13

0, 12

Case with zero.

0, 12

-24, 36

Use of absolute values with negative numbers.

-24, 36

When to use GCD or LCM

Both concepts compare numbers but answer different questions.

GCD

Use it to split quantities, simplify fractions or find the largest common divisor. If the GCD is 1, the numbers are coprime.

LCM

Use it for common denominators, repeating cycles or synchronizing multiples. It is the smallest number divisible by every value.

Frequently asked questions

What is the GCD?

The greatest common divisor is the largest number that divides every number in a list exactly.

What is the LCM?

The least common multiple is the smallest positive number that is a multiple of every number in a list.

How does the Euclidean algorithm work?

The Euclidean algorithm divides one number by another and repeats with the divisor and remainder until the remainder is 0. The last divisor is the GCD.

How is the GCD calculated with prime factors?

Factor each number and take only common prime factors with the lowest exponent. Their product is the GCD.

How is the LCM calculated with prime factors?

Factor each number and take every prime factor with its highest exponent. Their product is the LCM.

Can negative numbers be used?

Yes. The calculator accepts negative numbers but uses their absolute values to calculate the GCD and LCM.

What happens if one of the numbers is zero?

The GCD of a number and 0 is that number's absolute value. The LCM is shown as 0 when the list contains at least one 0.

What does it mean for two numbers to be coprime?

Their GCD is 1. They share no common divisor greater than 1.