keisoku

GCD and LCM Calculator

Find the greatest common divisor (GCD) and least common multiple (LCM) of several integers using the Euclidean algorithm, with a step table and coprime check.

Input

Enter integers separated by commas to compute the greatest common divisor (GCD) and least common multiple (LCM). Spaces and new lines also work as separators.

Example: 12, 18, 24

Result

Greatest common divisor (GCD)

6

Least common multiple (LCM)

72

Number of inputs

3

Coprime

No

Input integers (absolute value)

12
18
24

Euclidean algorithm steps

For the first two numbers, division is repeated until the remainder reaches 0.

DividendDivisorQuotientRemainder
181216
12620

The GCD is found with the Euclidean algorithm, and the LCM is the product divided by the GCD. Signs are ignored and absolute values are used.

How it works

  • The greatest common divisor (GCD) is the largest positive integer that divides every input, found by applying the Euclidean algorithm from left to right.
  • The least common multiple (LCM) is the smallest positive common multiple of all inputs, computed pairwise as the product divided by the greatest common divisor.
  • Signs are ignored and absolute values are used. When any input is zero, the least common multiple is treated as zero.
  • When the greatest common divisor equals 1, the integers are coprime.
  • If the least common multiple exceeds the safe integer range, it is reported as an overflow.

Reviews

Tell us what you think of this calculator.

Write a review

  1. Home
  2. GCD and LCM Calculator