Passer au contenu principal

GCD and LCM Calculator

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.

Frequently asked questions

The GCD (Greatest Common Divisor) is the largest integer that divides all given numbers exactly. The LCM (Least Common Multiple) is the smallest positive intege... The GCD (Greatest Common Divisor) is the largest integer that divides all given numbers exactly. The LCM (Least Common Multiple) is the smallest positive integer that is a multiple of all numbers. For example, for 12 and 18: GCD = 6 (since 6 divides both 12 and 18) and LCM = 36 (since 36 is the smallest common multiple of 12 and 18).

The Euclidean algorithm is based on the principle that GCD(a, b) = GCD(b, a mod b). We divide a by b, keep remainder r. We replace a with b and b with r, repeat... The Euclidean algorithm is based on the principle that GCD(a, b) = GCD(b, a mod b). We divide a by b, keep remainder r. We replace a with b and b with r, repeating until the remainder is 0. The last non-zero divisor is the GCD. It is one of the oldest and most efficient algorithms in mathematics.

The GCD is used to simplify fractions (by dividing numerator and denominator by their GCD), solve fair sharing problems, optimize computer algorithms and solve ... The GCD is used to simplify fractions (by dividing numerator and denominator by their GCD), solve fair sharing problems, optimize computer algorithms and solve cryptography problems (RSA algorithm). The LCM is useful for adding fractions with different denominators, calculating synchronization periods and solving calendar problems.

Two numbers are called coprime (or relatively prime) if their GCD equals 1. This does not mean the numbers are prime, but that they share no common divisor othe... Two numbers are called coprime (or relatively prime) if their GCD equals 1. This does not mean the numbers are prime, but that they share no common divisor other than 1. For example, 8 and 9 are coprime (GCD = 1) even though neither 8 nor 9 are prime numbers.

Yes. To calculate the GCD of several numbers, we use associativity: GCD(a, b, c) = GCD(GCD(a, b), c). Our tool supports up to 6 numbers simultaneously and displ... Yes. To calculate the GCD of several numbers, we use associativity: GCD(a, b, c) = GCD(GCD(a, b), c). Our tool supports up to 6 numbers simultaneously and displays intermediate steps for each pair. Same for LCM: LCM(a, b, c) = LCM(LCM(a, b), c).
Lien copié !