🧮 MathbeginnerOffline
GCD / LCM Calculator
Greatest common divisor and least common multiple of two numbers.
Inputs
Enter your values below.
Result
Your answer appears here.
Enter values and press Calculate — the result appears here.
How it works
The formula behind this calculator.
gcd(a,b) by Euclid: gcd(a,b) = gcd(b, a mod b); lcm(a,b) = (a·b) / gcd(a,b)
- a, b
- Two positive integers
Euclid's algorithm repeatedly replaces the larger number by the remainder until it reaches 0. The last non-zero remainder is the GCD.
Example: gcd(48, 18) = gcd(18, 12) = gcd(12, 6) = 6; lcm(48, 18) = 144
Ref: Euclid's Elements, Book VII, Propositions 1–2 (~300 BC)
Tips
- 💡 GCD of two coprime numbers (e.g. 8 and 9) is always 1.
- 💡 LCM × GCD = the product of the two numbers, when both are > 0.