Passer au contenu principal

GCD and LCM Calculator: Find Greatest Common Divisor and Least Common Multiple

Use GCD and LCM Calculator online for your needs

Calculate the GCD and LCM of 2 to 6 numbers with full Euclidean algorithm steps.

2 numbers
Examples: 12, 18 36, 48 100, 75 12, 18, 24 60, 84, 120 17, 31 (premiers) 1024, 256
↵ Enter to calculate
Enter your numbers and click Calculate.

How to calculate GCD and LCM?

The GCD (Greatest Common Divisor) is the largest integer that divides two or more numbers exactly without a remainder. The LCM (Least Common Multiple) is the smallest positive integer that is a common multiple of all the numbers. These two concepts are fundamental in arithmetic, particularly for simplifying fractions and solving synchronization problems.

The Euclidean algorithm for GCD

The Euclidean algorithm is the most efficient method to calculate GCD. For two numbers a and b, divide a by b and keep remainder r. Then replace a with b and b with r, repeating until the remainder is 0. The last non-zero remainder is the GCD. Example: GCD(48, 18) → 48 = 2×18 + 12 → 18 = 1×12 + 6 → 12 = 2×6 + 0 → GCD = 6.

Relationship between GCD and LCM

For two numbers a and b: GCD(a,b) × LCM(a,b) = a × b. Therefore LCM(a,b) = (a × b) / GCD(a,b). For more than two numbers, GCD and LCM are calculated successively in pairs using the associativity of these operations.