GCF and LCM Calculator

Calculate both the Greatest Common Factor (GCF) and Least Common Multiple (LCM) together using prime factorization. Verify with GCF x LCM = a x b.

Enter Numbers

Prime Factor Comparison

Prime In a In b GCF (min) LCM (max)

Quick Examples

Results

Greatest Common Factor (GCF)
--
Least Common Multiple (LCM)
--
a --
b --
a x b --
GCF x LCM --
Verified: GCF x LCM = a x b? --
Coprime? --

Step-by-Step Solution

GCF x LCM = a x b

Understanding GCF and LCM Together

The Greatest Common Factor (GCF) and Least Common Multiple (LCM) are two of the most fundamental concepts in number theory, and they are closely related. For any two positive integers a and b, there is an elegant relationship: GCF(a, b) x LCM(a, b) = a x b. This calculator demonstrates both concepts side by side using prime factorization.

The GCF is found by taking the minimum exponent of each common prime factor, while the LCM is found by taking the maximum exponent of each prime factor that appears in either number. Together, they provide a complete picture of how two numbers relate through their prime structure.

The GCF-LCM Relationship

GCF (Minimum Exponents)

Product of all common primes raised to their lowest power in either number.

GCF = product of p^min(a_i, b_i)

LCM (Maximum Exponents)

Product of all primes (from either number) raised to their highest power.

LCM = product of p^max(a_i, b_i)

The Fundamental Identity

The product of GCF and LCM always equals the product of the two numbers.

GCF(a,b) x LCM(a,b) = a x b

Computing LCM from GCF

Once you know the GCF, LCM can be found without additional factoring.

LCM(a,b) = (a x b) / GCF(a,b)

How the Prime Factorization Method Works

  1. Factor both numbers into their prime factorizations.
  2. List all primes that appear in either factorization.
  3. For the GCF: For each prime, take the smaller exponent (or 0 if it does not appear in one number). Multiply these together.
  4. For the LCM: For each prime, take the larger exponent. Multiply these together.
  5. Verify: Check that GCF x LCM = a x b.

Example: GCF and LCM of 36 and 48

36 = 2^2 x 3^2 and 48 = 2^4 x 3^1. The primes involved are 2 and 3.

  • GCF: 2^min(2,4) x 3^min(2,1) = 2^2 x 3^1 = 4 x 3 = 12
  • LCM: 2^max(2,4) x 3^max(2,1) = 2^4 x 3^2 = 16 x 9 = 144
  • Verify: 12 x 144 = 1728 = 36 x 48. Correct!

Practical Applications

  • Adding fractions: The LCM of the denominators gives the least common denominator.
  • Simplifying fractions: Divide numerator and denominator by their GCF.
  • Scheduling: LCM helps find when events on different cycles will coincide again.
  • Gear design: GCF and LCM are used for calculating gear ratios and tooth counts.
  • Music: Finding when rhythmic patterns with different beat lengths will realign.

Special Cases

  • If a and b are coprime (GCF = 1), then LCM = a x b.
  • If a divides b, then GCF = a and LCM = b.
  • GCF(a, a) = a and LCM(a, a) = a.
  • The GCF is always a divisor of the LCM.