Calculate the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) with complete Euclidean algorithm steps. Supports two or more numbers.
The Greatest Common Divisor (GCD) and Least Common Multiple (LCM) are two of the most important concepts in elementary number theory, with applications from simplifying fractions in middle school to cryptographic algorithms that secure the internet.
The Euclidean algorithm, described by Euclid around 300 BC, is one of the oldest and most efficient algorithms in mathematics. It computes the GCD in O(log(min(a,b))) steps, terminating rapidly even for very large numbers. The algorithm applies the identity: GCD(a, b) = GCD(b, a mod b) repeatedly until the remainder is zero.
This calculator shows the complete Euclidean algorithm step by step for two numbers, and also computes GCD and LCM for lists of multiple numbers using the generalization: GCD(a, b, c) = GCD(GCD(a, b), c).
Find GCD(48, 18): 48 = 2×18 + 12 → 18 = 1×12 + 6 → 12 = 2×6 + 0. GCD = 6. LCM = |48×18|/6 = 864/6 = 144. Check: 144/48 = 3 ✓, 144/18 = 8 ✓.