How to Use
- Enter numbers
Input two or more positive integers separated by commas.
- Calculate
Click Calculate to find both the GCD and LCM simultaneously.
- View results
The GCD, LCM, and prime factorization steps are displayed.
What are the GCD and LCM?
The greatest common divisor (GCD) is the largest number that divides two or more integers without leaving a remainder, while the least common multiple (LCM) is the smallest positive number that all of those integers divide into evenly.
For example, the common divisors of 12 and 18 are 1, 2, 3, and 6, so the GCD is 6, and the first multiple they share is 36, which is the LCM.
Where is it used?
- GCD: simplifying fractions, and finding the largest equal group when splitting items evenly
- LCM: finding a common denominator, and determining when two events with different cycles line up again (for example, bus schedules)
Formula
The GCD is found using the Euclidean algorithm.
GCD(a, b) = GCD(b, a mod b) — repeat until the remainder is 0, and the value at that point is the GCD.
The LCM is derived from the GCD.
LCM(a, b) = |a × b| / GCD(a, b)
Example: 12 and 18
- GCD: 18 mod 12 = 6 → 12 mod 6 = 0 → GCD = 6
- LCM: (12 × 18) / 6 = 36
Here a and b are the integers you entered; with three or more numbers, they are combined two at a time in sequence.