Number Theory • Core Pillar

GCF Calculator (Greatest Common Factor)

Calculate the Greatest Common Factor (GCD/HCF) and Least Common Multiple (LCM) for two or more positive integers with prime factorization trees and Euclidean algorithm division steps.

|
Last Updated: September 2026
|
Arbitrary-Precision & Multi-Input Engine
Number Theory • Precision Engine

Interactive GCF & LCM Calculator

Compute the Greatest Common Factor (GCF/GCD) and Least Common Multiple (LCM) for two or more integers with step-by-step prime factorizations and Euclidean division proofs.

Quick Example Presets
3 numbers detected

Enter 2 or more whole numbers (e.g. 25, 75, 275). Results update instantly.

Greatest Common Factor (GCF)
25
Largest integer dividing 25, 75, and 275 evenly
Coprime Status Shared Common Factor: 25
Least Common Multiple (LCM)
825
Smallest positive multiple divisible by 25, 75, and 275
Duality Rule GCF × LCM = Factor Product

Prime Factor Power Matrix & Intersection

Lowest-Power Rule: ∏ pimin(e)
Integer Canonical Prime Factorization Expanded Factors

Step-by-Step Mathematical Proofs

Compare analytical prime factor intersection and Euclidean recursive division.

Direct Answer & Overview
Verified Educational Guide

What is the Greatest Common Factor (GCF)?

The Greatest Common Factor (GCF), also known as the Greatest Common Divisor (GCD) or Highest Common Factor (HCF), is the largest positive integer that divides two or more numbers evenly without a remainder. If GCF(a, b) = 1, the numbers are coprime.

Primary Mathematical Formula Standard Mathematical Model
Standard Equation
ƒ(x)
Q.E.D.
GCF(a, b) = ∏ p_i^min(e_a, e_b) | GCF(a, b) × LCM(a, b) = |a × b|
Evaluated with exact mathematical formulation • Rigorously verified
Exact Formula
Input Parameters
Required
1
Input Integers: Two or more comma-separated positive integers (e.g., 24, 36, 60)
2
Calculation Method: Prime factor power intersection or Euclidean remainder division
Expected Outputs
Calculated
Greatest Common Factor (GCF / GCD): Largest common divisor integer
Least Common Multiple (LCM): Smallest positive integer multiple divisible by all inputs
Step-by-Step Proof: Prime factor trees and Euclidean algorithm quotient-remainder steps

GCF & Divisor Fundamentals

In number theory, a positive integer d is a divisor (or factor) of an integer n if there exists an integer k such that n = d × k (meaning division produces zero remainder: n mod d = 0).

The Greatest Common Factor (GCF), universally written in mathematical literature as &gcd;(a, b), represents the maximal element in the intersection set of all divisors of a and b:

&gcd;(a, b) = max { d ∈ ℤ+ : d | a and d | b }
Coprime Numbers
&gcd;(a, b) = 1

When two integers share no common positive factor other than 1, they are called coprime or relatively prime (e.g., 8 and 15, or any two distinct prime numbers).

Multi-Number GCF Associativity
&gcd;(a, b, c) = &gcd;(&gcd;(a, b), c)

The GCF operation is strictly associative and commutative, allowing any number of integers to be simplified pairwise in arbitrary order.

The Two Primary GCF Algorithms

Depending on whether you are working with small numbers by hand or large values programmatically, two core mathematical algorithms are used to determine the GCF:

1

The Prime Factorization Method (Lowest Power Rule)

By the Fundamental Theorem of Arithmetic, every integer greater than 1 has a unique prime factorization. To find &gcd;(a, b), express both numbers as prime products and take the minimum exponent of each common prime:

&gcd;(a, b) = p1min(e1, f1) × p2min(e2, f2) × ... × pkmin(ek, fk)

Best for: Classroom homework, small numbers under 1,000, and algebraic monomial factoring (e.g., &gcd;(12x³y, 18x²y²) = 6x²y).

2

The Euclidean Algorithm (Division by Remainders)

Described by the Greek mathematician Euclid in Elements (~300 BC), this algorithm relies on the principle that &gcd;(a, b) = &gcd;(b, a mod b). Repeated integer division produces successively smaller remainders until the remainder is zero:

Step Division Formula Quotient (q) Remainder (r)
1 252 = 105 × 2 + 42 2 42
2 105 = 42 × 2 + 21 2 21
3 42 = 21 × 2 + 0 2 0 (→ GCF = 21)

Best for: Large integers, cryptographic computing, and fast logarithmic convergence in $O(\log(\min(a, b)))$ steps.

GCF and LCM Dual Relationship

The Greatest Common Factor (GCF) and the Least Common Multiple (LCM) are fundamental mathematical duals. For any two positive integers a and b, the product of their GCF and LCM is strictly equal to the product of the original integers:

&gcd;(a, b) × lcm(a, b) = a × b

This identity provides the most computationally efficient method for finding the LCM: first compute &gcd;(a, b) using the Euclidean algorithm, then compute:

lcm(a, b) = (a × b) ÷ &gcd;(a, b)

Real-World Applications & Industry Use Cases

Greatest Common Divisors govern optimal spatial packaging, cryptography, and engineering synchronizations:

Tile & Architectural Layouts

Finding the largest square floor tiles that will cover a rectangular room of dimensions 240 cm × 360 cm without cutting any tiles requires calculating &gcd;(240, 360) = 120 cm square tiles.

RSA Public-Key Cryptography

Digital encryption keys require selecting a public exponent e such that &gcd;(e, φ(n)) = 1 (coprimality with Euler's totient function). The Extended Euclidean Algorithm is used to derive the private decryption key.

Mechanical Gear Mesh & Wear Distribution

Engineers design interlocking gear teeth counts to be coprime (e.g. 17 teeth and 43 teeth, with GCF = 1) so that every tooth on gear A touches every tooth on gear B before repeating, ensuring uniform wear.

Inventory Packaging & Batching

Distributing 120 pens, 80 notebooks, and 60 keychains into identical promotional gift kits without leftovers requires computing &gcd;(120, 80, 60) = 20 kits.

Step-by-Step Worked Examples

Examine these verified numerical solutions across varying calculation difficulty tiers:

Example 1 • Two Numbers via Prime Factorization Basic

Find GCF(48, 72)

1. Prime factorize 48: 48 = 2⁴ × 3¹.

2. Prime factorize 72: 72 = 2³ × 3².

3. Common prime factors: 2 and 3.

4. Take lowest powers: 2³ × 3¹ = 8 × 3 = 24.

5. Final: GCF(48, 72) = 24 (LCM = 144).

Example 2 • Large Numbers via Euclidean Algorithm Intermediate

Find GCF(1071, 462)

1. 1071 ÷ 462 = 2 remainder 147 → 1071 = 462 × 2 + 147

2. 462 ÷ 147 = 3 remainder 21 → 462 = 147 × 3 + 21

3. 147 ÷ 21 = 7 remainder 0 → 147 = 21 × 7 + 0

4. Last non-zero remainder: 21.

5. Final: GCF(1071, 462) = 21.

Common Calculation Pitfalls

1. Confusing GCF with LCM

Remember: GCF is a factor/divisor (always ≤ min(a, b)), whereas LCM is a multiple (always ≥ max(a, b)).

2. Taking Highest Exponent Instead of Lowest

When using prime factorizations, always select the lowest power of common primes for GCF. Highest powers produce the LCM.

Fact-Checked & Verified • Computational Accuracy Standards
Updated July 2026 • Editorial Policy
Authored By
Sanjay Samanta

Lead Developer & Founder of Basic Math Tools. Specializes in browser-native computational algorithms and applied mathematics.

Reviewed & Verified By
Academic Review Board

Mathematics & curriculum specialists. Audited against standard algebraic and arithmetic principles.

Found an error or have an improvement suggestion? Report a calculation issue

Connected Number Theory Solvers

Ecosystem Hub

Frequently Asked Questions

What is the Greatest Common Factor (GCF)?
The Greatest Common Factor (GCF), also known as the Greatest Common Divisor (GCD) or Highest Common Factor (HCF), is the largest positive integer that divides two or more given integers without leaving a remainder. For example, GCF(24, 36) = 12.
How do you find the GCF using prime factorization?
Break down each number into its prime factor components with exponents. Identify all prime factors common to all numbers, take the lowest exponent for each common prime, and multiply them together. For example, for 24 (2³ × 3) and 36 (2² × 3²), the common primes with lowest powers are 2² × 3¹ = 12.
How does the Euclidean algorithm find the GCF?
The Euclidean algorithm computes GCF(a, b) by repeatedly replacing the larger number with the remainder of dividing the larger by the smaller: a mod b. Continue until the remainder is 0; the last non-zero remainder is the GCF. This method is exceptionally fast for very large numbers.
What is the mathematical relationship between GCF and LCM?
For any two positive integers a and b, their product equals the product of their GCF and LCM: GCF(a, b) × LCM(a, b) = a × b. Therefore, LCM(a, b) = (a × b) ÷ GCF(a, b).
What does it mean if two numbers are "coprime"?
Two integers are coprime (or relatively prime) if their greatest common factor is 1: GCF(a, b) = 1. This means they share no common prime factors. For example, 8 (2³) and 15 (3 × 5) are coprime because GCF(8, 15) = 1.
How do you find the GCF of three or more numbers?
To find GCF(a, b, c), first calculate GCF(a, b), then calculate the GCF of that result and c: GCF(a, b, c) = GCF(GCF(a, b), c). Alternatively, take the prime factorizations of all three numbers and multiply the lowest power of all common prime factors.
Can the GCF of numbers be negative or zero?
By mathematical definition, the GCF is always a positive integer. For non-zero integers, GCF(-a, b) = GCF(a, b). If one number is 0 and the other is a non-zero integer x, GCF(x, 0) = |x|. GCF(0, 0) is undefined.
What are the main real-world applications of GCF?
GCF is used in simplifying fractions to lowest terms, designing repeating tile and brick layouts without cutting, optimizing item distribution and packaging batches, generating encryption keys in RSA cryptography, and calculating synchronized gear rotations in mechanics.