IQRCalculator

GCF Calculator

The largest whole number that divides every number in your list, with Euclid’s algorithm and the prime factors shown.

Two to twenty whole numbers, separated by commas or spaces.

Result

Greatest common factor1248, 180
GCF
12
LCM
720
How it was calculated
  1. Euclid’s algorithm
    180 = 3 × 48 + 36
    48 = 1 × 36 + 12
    36 = 3 × 12 + 0

    The last non-zero remainder, 12, is the greatest common factor.

  2. Prime factorizations
    NumberPrime factors
    4824 × 3
    18022 × 32 × 5

    GCF: multiply the primes common to every number, each at its lowest power.

How to use it

Type between 2 and 20 whole numbers separated by commas or spaces, such as 48, 180. The arithmetic is exact: the numbers are handled as arbitrary-precision integers, so values of up to 30 digits each are processed without rounding.

Two ways to find the GCF

Euclid’s algorithm replaces the larger number by the remainder after dividing it by the smaller one, and repeats until the remainder is 0. The last non-zero remainder is the GCF.

GCF(a, b) = GCF(b, a mod b), and GCF(a, 0) = aa, b — whole numbers with a ≥ b; a mod b — the remainder of a ÷ b

Prime factorization writes each number as a product of primes. The GCF is the product of the primes common to every number, each taken at its lowest power. It is easy to read for small numbers, while Euclid’s method stays fast for huge ones because it never has to factor anything.

For two numbers the calculator lists every division of Euclid’s algorithm. For three or more it works through the list pairwise, using GCF(a, b, c) = GCF(GCF(a, b), c). When every number is between 2 and 1015 in size, it also shows the prime factorization of each.

Worked examples

GCF of 48 and 180

Given: 48, 180

  • 180 = 3 × 48 + 36
  • 48 = 1 × 36 + 12
  • 36 = 3 × 12 + 0

The last non-zero remainder is 12. The factorizations agree: 48 = 24 × 3 and 180 = 22 × 32 × 5, and the shared primes at their lowest powers give 22 × 3 = 12. Dividing top and bottom by 12 reduces the fraction 48/180 to 4/15.

Three numbers: 84, 126 and 210

Given: 84, 126, 210

Pairwise: GCF(84, 126) = 42, then GCF(42, 210) = 42. From the factorizations 84 = 22 × 3 × 7, 126 = 2 × 32 × 7 and 210 = 2 × 3 × 5 × 7, the primes common to all three are 2, 3 and 7, each to the power 1: 2 × 3 × 7 = 42.

Conventions and edge cases

  • Negative numbers: signs are ignored and the GCF is reported as non-negative, so GCF(−12, 18) = 6.
  • Zero: every whole number divides 0, so GCF(0, n) = |n|. For example, GCF(0, −12) = 12.
  • Coprime numbers: a GCF of 1 means the numbers share no prime factor, as with 8 and 15.
  • Decimals are rejected; the GCF is defined here for integers only.

The least common multiple of the same list is shown next to the GCF. For two non-zero numbers the two are linked by GCF(a, b) × LCM(a, b) = |a × b|, a step the LCM calculator shows. To reduce a fraction directly, the fraction calculator applies the GCF for you.

Questions

Are GCF, GCD and HCF the same thing?

Yes. Greatest common factor (GCF), greatest common divisor (GCD) and highest common factor (HCF) are three names for the same number; which one you meet depends on the country and the textbook.

What is the GCF used for in practice?

Simplifying fractions and splitting things into identical groups. With 48 apples and 180 oranges you can fill at most GCF(48, 180) = 12 identical bags with nothing left over, each holding 4 apples and 15 oranges.

Why use Euclid’s algorithm instead of listing all the factors?

Listing factors becomes slow as numbers grow, while the number of steps in Euclid’s algorithm grows only with the number of digits — by Lamé’s theorem, at most about five divisions per decimal digit of the smaller number.

Method & sources