- What is the greatest common divisor (GCD)?
- The GCD of a set of integers is the largest positive integer that divides each of them with no remainder. For 12 and 18 it is 6, because 6 divides both and no larger number does. It is also called the greatest common factor (GCF) or highest common factor (HCF).
- What is the least common multiple (LCM)?
- The LCM of a set of integers is the smallest positive integer that is a multiple of every number in the set. For 4 and 6 it is 12, because 12 is the smallest number that both 4 and 6 divide evenly.
- How are GCD and LCM related?
- For any two integers a and b, gcd(a, b) × lcm(a, b) = |a × b|. So once you know the GCD you can get the LCM as |a × b| ÷ gcd(a, b) without listing multiples. This calculator uses exactly that identity.
- What does it mean for numbers to be coprime?
- Two integers are coprime (relatively prime) when their GCD is 1 — they share no common factor other than 1. 17 and 5 are coprime, so their GCD is 1 and their LCM is simply their product, 85.
- How does Euclid's algorithm find the GCD?
- Euclid's algorithm repeatedly replaces the larger number with the remainder of dividing it by the smaller one, until the remainder is zero. The last non-zero value is the GCD. It is far faster than factoring, especially for large numbers.
- What happens with zero or a single number?
- Following the standard convention, gcd(n, 0) = |n| and gcd(0, 0) = 0; the LCM is guarded to return 0 whenever one input is 0 so there is never a division by zero. You need at least two valid integers, otherwise the calculator shows a dash.