Greatest Common Factor Calculator Formula

Understand the math behind the greatest common factor calculator. Each variable explained with a worked example.

Formulas Used

Gcf

gcf = gcd(a, b)

Lcm Val

lcm_val = lcm(a, b)

Product

product = a * b

Variables

VariableDescriptionDefault
aFirst Number48
bSecond Number36

How It Works

How to Find the Greatest Common Factor

Methods

Method 1: Prime Factorization 1. Find the prime factors of each number 2. Identify the common prime factors 3. Multiply the common factors together

Method 2: Euclidean Algorithm 1. Divide the larger number by the smaller 2. Replace the larger number with the remainder 3. Repeat until the remainder is 0 4. The last non-zero remainder is the GCF

Useful Identity

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

Worked Example

Find the GCF of 48 and 36.

a = 48b = 36
  1. 01Prime factorization of 48: 2⁴ × 3 = 2 × 2 × 2 × 2 × 3
  2. 02Prime factorization of 36: 2² × 3² = 2 × 2 × 3 × 3
  3. 03Common factors: 2² × 3 = 4 × 3
  4. 04GCF(48, 36) = 12