Greatest Common Factor Methods Compared
Compare listing, prime factorization, the ladder and the Euclidean algorithm for finding a GCF, and know which one to pick.
Key takeaways
- The GCF is the largest positive number that divides every number in the group.
- Listing factors is clear for small numbers but grows slow and error-prone for large ones.
- With prime factorizations, take each shared prime the smallest number of times it appears.
- The Euclidean algorithm replaces factoring with repeated division and handles large numbers quickly.
- In algebra, the GCF of the terms is the first thing to factor out of a polynomial.
The greatest common factor, or GCF, of two or more whole numbers is the largest number that divides all of them without a remainder. For 84 and 126 it is 42. It is also called the greatest common divisor.
You can find it by listing factors, by comparing prime factorizations, by dividing in a shared ladder or by the Euclidean algorithm. All four give the same answer. They differ in speed, and the best choice depends on how large and how friendly the numbers are.
What the GCF measures
A common factor divides every number in the group. The numbers 24 and 36 share the factors 1, 2, 3, 4, 6 and 12. The greatest is 12.
Picture two ribbons, 24 inches and 36 inches long. You want to cut both into equal pieces, as long as possible, with nothing left over. The piece length must divide both, so the longest choice is 12 inches. That gives 2 pieces and 3 pieces.
Every pair of positive integers has at least the common factor 1. If 1 is the greatest, the numbers are called relatively prime or coprime. The numbers 8 and 15 are coprime even though neither one is prime.
The GCF can never be larger than the smallest number in the group, which gives you an instant sanity check. If one number divides the others, it is the GCF: for 15, 45 and 60, the answer is 15.
Method 1: list the factors
Write all factors of each number, then find the largest on both lists.
84: 1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 42, 84
126: 1, 2, 3, 6, 7, 9, 14, 18, 21, 42, 63, 126
common: 1, 2, 3, 6, 7, 14, 21, 42
GCF = 42 Find factors in pairs so you do not skip any: 1 × 84, 2 × 42, 3 × 28, 4 × 21, 6 × 14, 7 × 12. You can stop once the two members of a pair would cross over.
This method shows the meaning of the GCF better than any other, and it is a good first lesson. It also reveals a pattern: every common factor divides the greatest one. Its weakness is that missing a single factor can spoil the answer, and large numbers have long lists.
Method 2: prime factorization
Break each number into primes, then keep only what they share.
84 = 2² × 3 × 7
126 = 2 × 3² × 7
shared: one 2, one 3, one 7
GCF = 2 × 3 × 7 = 42 The rule in exponent language is to take the smaller exponent of each prime that appears in every number. A prime missing from any one number is left out.
This works smoothly for three or more numbers. For 24 = 2³ × 3, 60 = 2² × 3 × 5 and 96 = 2⁵ × 3, the shared part is 2² × 3 = 12.
The cost is factoring itself. If you need a refresher, see factor trees and ladders.
Method 3: the shared ladder
Write the numbers side by side and divide all of them by any common prime. Repeat until no prime divides them all.
2 | 84 126
3 | 42 63
7 | 14 21
2 3
GCF = 2 × 3 × 7 = 42 The bottom row, 2 and 3, tells you what is left over: 84 = 42 × 2 and 126 = 42 × 3. As a bonus, multiplying the GCF by the bottom row gives the least common multiple, 42 × 2 × 3 = 252.
With only two numbers this bonus is dependable. With three or more, the least common multiple needs extra steps, because some primes are shared by only part of the group.
Method 4: the Euclidean algorithm
This procedure appears in Euclid's Elements and needs no factoring at all. Divide the larger number by the smaller and keep the remainder. Replace the larger number with the smaller and the smaller with the remainder. Stop when the remainder is 0. The last nonzero remainder is the GCF.
GCF of 1,071 and 462
1071 = 2 × 462 + 147
462 = 3 × 147 + 21
147 = 7 × 21 + 0
GCF = 21
check: 1071 = 21 × 51 and 462 = 21 × 22 Why does it work? In a = qb + r, any number dividing a and b also divides r = a - qb. Any number dividing b and r also divides a. So the pair (a, b) and the pair (b, r) have exactly the same common factors, and therefore the same greatest one. The remainders keep shrinking, so the process must end.
Choosing a method
| Method | Best when | Main risk |
|---|---|---|
| Listing factors | numbers below about 50 | missing a factor |
| Prime factorization | several numbers, or variables | slow if factoring is hard |
| Shared ladder | two numbers with small shared primes | stopping too early |
| Euclidean algorithm | large or awkward numbers | arithmetic slips in remainders |
A quick mental trick comes from the same logic as Euclid's method: the GCF of two numbers must divide their difference. For 91 and 104 the difference is 13, so the GCF is 13 or 1. Testing shows 91 = 7 × 13 and 104 = 8 × 13, so it is 13.
It follows that consecutive integers are always coprime, since their difference is 1.
The GCF of algebraic terms
For monomials, handle the coefficients and each variable separately. Take the GCF of the numbers, and for each variable present in every term, take the lowest power.
18x³y and 24x²y²
numbers: GCF of 18 and 24 is 6
x: lowest power is x²
y: lowest power is y
GCF = 6x²y
18x³y + 24x²y² = 6x²y(3x + 4y) Expand the right side to check it. The terms left inside, 3x and 4y, share no further factor.
Whole expressions can be common factors too. In 5x(x - 2) + 3(x - 2), the GCF is x - 2, and the result is (x - 2)(5x + 3). When the leading term is negative, many people factor out the negative: -4x² + 10x = -2x(2x - 5). This is distribution in reverse.
Using the GCF to reduce fractions
Dividing the numerator and denominator by their GCF reduces a fraction in a single step: 84/126 = 2/3 after dividing both by 42.
You may also reduce in stages, by 2, then 3, then 7. Staged reduction is fine as long as you finish. The GCF simply guarantees that you are done.
Solving grouping problems
Word problems that call for a GCF usually ask you to split two or more collections into matching groups, as many or as large as possible, with nothing left over.
Say you have 48 pencils and 72 erasers, and you want to make identical kits using all of them. The number of kits must divide 48 and must divide 72. The largest such number is the GCF, 24. Each kit then holds 48 ÷ 24 = 2 pencils and 72 ÷ 24 = 3 erasers.
A tiling problem has the same shape. To cover a floor measuring 168 inches by 120 inches with the largest possible square tiles, without cutting any, the tile side must divide both lengths.
168 = 1 × 120 + 48
120 = 2 × 48 + 24
48 = 2 × 24 + 0
tile side = 24 inches
tiles needed = (168 ÷ 24) × (120 ÷ 24) = 7 × 5 = 35 The GCF gives the size of each tile, and a second step gives the count. Read the question to see which of the two it wants. Smaller tiles that also fit, such as 12 inches or 8 inches, correspond to the other common factors, all of which divide 24.
A worked comparison on one pair
Take 360 and 504 and watch how the work differs.
Listing is painful here, since 360 alone has 24 factors. Prime factorization is manageable: 360 = 2³ × 3² × 5 and 504 = 2³ × 3² × 7, so the shared part is 2³ × 3² = 72. The ladder reaches it by dividing by 2 three times and by 3 twice, ending with 5 and 7.
The Euclidean algorithm is shortest of all.
504 = 1 × 360 + 144
360 = 2 × 144 + 72
144 = 2 × 72 + 0
GCF = 72 Three lines, with no need to know a single prime. For a pair such as 10,403 and 10,807, the gap grows enormously. Neither number has an obvious small factor, while the difference, 404 = 4 × 101, points straight to the only serious candidate, 101. Indeed 10,403 = 101 × 103 and 10,807 = 101 × 107.
Checking your answer
Divide each original number by your GCF. Every quotient must be a whole number, which shows that you found a common factor. Then compute the GCF of the quotients. If it is 1, your factor was the greatest. If it is larger, multiply it into your answer and test again.
For algebraic work, expand the factored expression and compare it term by term with the original. Then look inside the parentheses for any number or variable that every term still shares. Both checks take only a moment.
Common errors
- Picking a common factor that is not the greatest. After factoring, check whether the leftover parts still share something.
- Taking the largest exponent. That builds a common multiple, not a common factor.
- Forgetting the leftover 1. In 7a + 7, the result is 7(a + 1).
- Confusing factor with multiple. The GCF is small, at most the smallest number. A common multiple of positive numbers is at least as large as the biggest one.
Common questions
How do I handle three large numbers?
Work in pairs. Find the GCF of the first two, then find the GCF of that result and the third. For 360, 504 and 600, the first pair gives 72, and the GCF of 72 and 600 is 24. The order you choose does not affect the answer, so start with whichever pair looks easiest. If you ever reach 1, you can stop at once, since nothing smaller is possible.
What is the GCF of a number and 0?
Every nonzero integer divides 0, so the GCF of n and 0 is the size of n, for n ≠ 0. This is why the Euclidean algorithm can stop at a zero remainder.
Is there a link between the GCF and the LCM?
For two positive integers, the GCF times the LCM equals the product of the numbers. With 84 and 126, 42 × 252 = 10,584 = 84 × 126. The shortcut does not extend directly to three numbers.
Do polynomials have a greatest common divisor?
They do, and a version of the Euclidean algorithm using polynomial division finds it, as described in the GCD of two polynomials.