🔢 GCF/LCM Calculator
Calculate the Greatest Common Factor (GCF) and Least Common Multiple (LCM) of two numbers.
Enter values for A and B to display the prime factor comparison
Greatest Common Factor (GCF/GCD)
The largest number that is a common divisor of two or more numbers. Found by multiplying the minimum exponents of common prime factors.
Least Common Multiple (LCM)
The smallest number that is a common multiple of two or more numbers. Found by multiplying the maximum exponents of all prime factors.
Euclidean Algorithm
An efficient algorithm for finding the GCF. Repeat until the remainder becomes 0.
GCF ↔ LCM Relationship
Applications
Used for simplifying fractions (GCF), finding common denominators (LCM), period problems, and tile layout optimization.
Worked Examples
For 12 and 18 the GCF is 6 and the LCM is 36, because 12 × 18 = 216 and 216 / 6 = 36.
For 48 and 180 the GCF is 12 and the LCM is 720; the Euclidean algorithm needs only three divisions: 180 mod 48 = 36, 48 mod 36 = 12, 36 mod 12 = 0.
Limits of This Calculator
Both inputs must be positive integers; decimals and negatives are outside the definition. The relation GCF × LCM = a × b holds for two positive integers only, so it does not extend to three numbers at once. Factors are computed with integer arithmetic, but results are shown rounded for display above 15 digits.
Frequently Asked Questions
- What is the difference between GCF and LCM?
- The greatest common factor is the largest number dividing both inputs, used to simplify fractions. The least common multiple is the smallest number both inputs divide, used to add fractions and to find when two cycles line up.
- Why does GCF × LCM equal a × b?
- Every prime factor of a and b appears in the GCF at its lower exponent and in the LCM at its higher exponent, so the two products together contain each prime exponent exactly twice — the product a × b.
- How does the Euclidean algorithm work?
- Divide the larger number by the smaller and keep the remainder, then repeat with the previous divisor and remainder. The last non-zero remainder is the GCF; it terminates because remainders strictly decrease.