SpeedDrain
Euclidean Algorithm · Prime Factorization · Multiple Integers

GCD & LCM Calculator

Find the Greatest Common Divisor (GCD/HCF) and Least Common Multiple (LCM) with step-by-step Euclidean algorithm remainders.

Presets:

Supports 2, 3, or more integers with step-by-step Euclidean remainder division.

Greatest Common Divisor (GCD / HCF)
12

The largest positive integer that divides all entered numbers without a remainder.

Least Common Multiple (LCM)
720

The smallest positive integer that is divisible by all entered numbers.

Prime Factorization Method:

48 = 2^4 × 3
180 = 2^2 × 3^2 × 5
GCD Rule: Multiply lowest powers of common prime factors. LCM Rule: Multiply highest powers of all prime factors.

Euclidean Algorithm Step-by-Step Table

Dividend = Divisor × Quotient + Remainder (repeating until remainder = 0)
StepDividend (a)Divisor (b)Quotient (q)Remainder (r)Equation
#118048336180 = 48 × 3 + 36
#2483611248 = 36 × 1 + 12
#336123036 = 12 × 3 + 0
Identity Verification: GCD(a, b) × LCM(a, b) = |a × b| → 12 × 720 = 8640 (matches 48 × 180 = 8640)

Number Theory: Divisors, Multiples & Euclidean Algorithm

The Euclidean Algorithm

Formulated around 300 BC by Euclid of Alexandria in Elements, this is one of the oldest numerical algorithms still in widespread use.

It exploits the theorem that GCD(a, b) = GCD(b, a mod b). Repeating this division produces remainders that decrease rapidly until zero is reached; the last non-zero remainder is the GCD.

Prime Factorization Method

Express both numbers as products of prime factors. For each distinct prime factor:

  • GCD: Take the minimum power of common prime factors.
  • LCM: Take the maximum power of all prime factors appearing in either number.

Example: 48 = 2⁴ × 3¹ and 180 = 2² × 3² × 5¹. GCD = 2² × 3¹ = 12; LCM = 2⁴ × 3² × 5¹ = 720.

Fundamental Product Identity

For any two positive integers a and b, the product of their greatest common divisor and least common multiple always equals the product of the numbers:

GCD(a, b) × LCM(a, b) = a × b

When GCD(a, b) = 1, the numbers are coprime (mutually prime), and their LCM is simply a × b.