LCM & GCD Calculator
Find the Least Common Multiple and Greatest Common Divisor.
Formulas
๐ How It Works
Euclidean Algorithm
GCD uses Euclidean algorithm: repeatedly divide larger by smaller, GCD is last non-zero remainder.
LCM Formula
LCM(a,b) = (a ร b) รท GCD(a,b). This relationship makes LCM easy once GCD is known.
Multiple Numbers
For 3+ numbers, calculate GCD/LCM pairwise. GCD(a,b,c) = GCD(GCD(a,b), c) and same for LCM.
Mathematical Relationship
LCM ร GCD = Product of the numbers. This is a useful verification check.
Input Handling
Enter comma-separated positive integers. At least 2 numbers required for calculation.
๐ก Common Use Cases
Fraction Addition
Find LCM of denominators to get common denominator. 1/4 + 1/6 = 3/12 + 2/12 (LCM of 4,6 is 12).
Fraction Simplification
Divide numerator and denominator by GCD to reduce fractions. 24/36 รท GCD(12) = 2/3.
Scheduling Problems
Find when events sync up. If buses run every 12 and 18 minutes, they sync every LCM(12,18)=36 minutes.
Circular Track Problems
When do runners meet again? Use LCM of lap times to find when they return to start together.
Tile Pattern Calculation
Find smallest square that can be tiled by rectangles of different sizes. Use LCM of dimensions.
Computer Science
GCD and LCM are used in algorithms for cryptography, timing, and resource allocation.