LCM (Least Common Multiple)
The smallest positive integer that is divisible by all given numbers.
GCD (Greatest Common Divisor)
The largest positive integer that divides all given numbers without a remainder.
LCM(a, b) = |a × b| / GCD(a, b)
GCD uses Euclidean Algorithm
The Euclidean algorithm finds GCD by repeatedly replacing the larger number with the remainder of dividing the larger by the smaller until one number becomes zero.
Note
This calculator provides estimates only. Verify manually for critical calculations.
The Least Common Multiple (LCM) and Greatest Common Divisor (GCD) are fundamental concepts in number theory that have practical applications in mathematics, computer science, and everyday problem-solving. The GCD, also known as the Greatest Common Factor (GCF) or Highest Common Factor (HCF), represents the largest number that divides two or more integers without leaving a remainder. Meanwhile, the LCM is the smallest positive integer that is evenly divisible by all the given numbers.
These concepts are closely related through a beautiful mathematical relationship: for any two positive integers a and b, the product of their LCM and GCD equals the product of the numbers themselves (LCM × GCD = a × b). This relationship allows us to calculate one value if we know the other, making computations more efficient.
The Euclidean algorithm is one of the oldest algorithms still in use today, dating back to around 300 BC. Named after the Greek mathematician Euclid, this elegant method finds the GCD of two numbers through a series of divisions. The algorithm works by repeatedly replacing the larger number with the remainder of dividing it by the smaller number until the remainder becomes zero. The last non-zero remainder is the GCD.
For example, to find GCD(48, 18): 48 ÷ 18 = 2 remainder 12, then 18 ÷ 12 = 1 remainder 6, then 12 ÷ 6 = 2 remainder 0. Since the remainder is now 0, the GCD is 6, the last non-zero remainder. This algorithm is remarkably efficient, even for very large numbers, which is why it remains the preferred method for computing GCD in modern computing.
Another approach to finding LCM and GCD is through prime factorization, which expresses each number as a product of prime numbers. For GCD, we take the product of the lowest powers of common prime factors. For LCM, we take the product of the highest powers of all prime factors present in any of the numbers.
For instance, with 12 = 2² × 3 and 18 = 2 × 3², the GCD is 2¹ × 3¹ = 6 (taking minimum powers of common factors) and the LCM is 2² × 3² = 36 (taking maximum powers of all factors). While this method provides insight into the mathematical structure, the Euclidean algorithm is generally more efficient for computational purposes.
LCM and GCD have numerous practical applications. The GCD is used in simplifying fractions to their lowest terms, cryptography (RSA encryption relies heavily on GCD calculations), and determining common measurement intervals. The LCM is essential for finding common denominators when adding fractions, scheduling problems (when will two events coincide?), and gear ratio calculations.
In programming, GCD is used in graphics for aspect ratio calculations, in music for rhythm patterns, and in manufacturing for optimizing cutting patterns. Understanding these concepts is fundamental to many areas of mathematics and has practical implications in fields ranging from architecture to computer science.