TL
Tool Lab
💰Donate
💰Donate

LCM & GCD Calculator

Find the Least Common Multiple (LCM) and Greatest Common Divisor (GCD) of two integers, with step-by-step Euclidean algorithm.

6
GCD (Greatest Common Divisor)
144
LCM (Least Common Multiple)
2^4 × 3
Prime Factors of 48
2 × 3^2
Prime Factors of 18

Euclidean Algorithm Steps (GCD)

48 = 18 × 2 + 1218 = 12 × 1 + 612 = 6 × 2 + 0∴ GCD(48, 18) = 6

About This Tool

The GCD (Greatest Common Divisor) is the largest positive integer that divides both numbers without a remainder. The LCM (Least Common Multiple) is the smallest positive integer divisible by both numbers.

They are related by: LCM(a, b) = |a × b| / GCD(a, b). The Euclidean algorithm efficiently computes the GCD by repeatedly applying the remainder operation.

How to Use

  1. Enter two positive integers a and b.
  2. GCD and LCM are computed automatically.
  3. View the prime factorization of each number.
  4. Follow the Euclidean algorithm steps to see how GCD is derived.

Use Cases

Simplifying fractions (divide by GCD), finding a common denominator (use LCM), scheduling problems where two events repeat on different cycles (LCM = next coincidence), and number theory computations in cryptography.

FAQ

  • What does it mean if GCD is 1? Two numbers with GCD = 1 are called coprime (or relatively prime). They share no common factors other than 1, and a fraction with these as numerator/denominator is already in simplest form.
  • Is the GCD of two distinct primes always 1? Yes — two distinct prime numbers are always coprime, so their GCD is 1. If both numbers are the same prime, the GCD equals that prime.
  • Does this work for large numbers? The Euclidean algorithm is highly efficient even for large numbers. This tool computes safely within JavaScript integer precision limits.