calc-hub logocalc-hub.net
MathGCFFactorsFractionsCalculators

How to Find the Greatest Common Factor: Factor Lists, Primes and Euclid's Algorithm

T. Krause

To find the GCF, list the factors of each number and take the largest one they share. 36 and 48 share 1, 2, 3, 4, 6 and 12, so the GCF of 36 and 48 is 12.

To find the greatest common factor (GCF) of two numbers, list the factors of each one and take the largest factor that appears in both lists. The factors of 36 are 1, 2, 3, 4, 6, 9, 12, 18 and 36. The factors of 48 are 1, 2, 3, 4, 6, 8, 12, 16, 24 and 48. Both lists contain 1, 2, 3, 4, 6 and 12, so the GCF of 36 and 48 is 12.

Listing factors works well for small numbers. For larger ones, prime factorization or Euclid's algorithm is faster. This article works through all three methods by hand, then three or more numbers and the link between the GCF and the least common multiple. Every GCF below matches the GCF calculator run with the same numbers. The calculator also shows the working for all three methods.

How to Find the Greatest Common Factor: Factor Lists, Primes and Euclid's Algorithm

Method 1: list the factors

A factor of a number divides it with no remainder. To list them without missing any, find them in pairs. Start at 1 and test each number in turn. Every time one divides, write it down with its partner.

For 36:

  • 1 × 36
  • 2 × 18
  • 3 × 12
  • 4 × 9
  • 6 × 6

5 doesn't divide 36, and once the two numbers in a pair meet at 6 × 6 you can stop. The factors of 36 are 1, 2, 3, 4, 6, 9, 12, 18 and 36.

For 48:

  • 1 × 48
  • 2 × 24
  • 3 × 16
  • 4 × 12
  • 6 × 8

5 and 7 don't divide 48, and 7 × 7 = 49 is already past 48, so the list is complete. The factors of 48 are 1, 2, 3, 4, 6, 8, 12, 16, 24 and 48.

The common factors are the numbers in both lists: 1, 2, 3, 4, 6 and 12. The largest is 12, so GCF(36, 48) = 12.

Every common factor divides the GCF, and every factor of the GCF is a common factor. The factors of 12 are 1, 2, 3, 4, 6 and 12, the same list as above. The calculator uses this to list every common factor of the numbers you enter.

Method 2: prime factorization

Split each number into primes. Keep the primes that appear in every number, give each one the smallest power it has in any of them, and multiply.

Take 540 and 252. Divide by the smallest prime that goes in, and repeat until only primes are left:

  • 540 = 2 × 270 = 2 × 2 × 135 = 2 × 2 × 3 × 45 = 2 × 2 × 3 × 3 × 15 = 2 × 2 × 3 × 3 × 3 × 5, so 540 = 2² × 3³ × 5
  • 252 = 2 × 126 = 2 × 2 × 63 = 2 × 2 × 3 × 21 = 2 × 2 × 3 × 3 × 7, so 252 = 2² × 3² × 7

Both numbers contain 2 and 3. The prime 2 appears as 2² in both, so it goes in as 2². The prime 3 appears as 3³ in 540 and 3² in 252, so it goes in as 3², the smaller power. 5 is only in 540 and 7 only in 252, so neither goes in.

GCF(540, 252) = 2² × 3² = 4 × 9 = 36.

This method is quick when the numbers split into small primes. It slows down when a number has a large prime factor, because you have to test many primes before you find it. If you'd rather not do the splitting by hand, the prime factorization calculator writes a whole number as a product of primes with exponents, such as 2^3 × 3^2 × 5 for 360.

Method 3: Euclid's algorithm

Euclid's algorithm needs no factoring at all. It rests on one fact. Any number that divides both a and b also divides the remainder of a ÷ b. So the GCF of a and b is the GCF of b and that remainder, and the numbers get smaller at each step.

The steps:

  1. Divide the larger number by the smaller one and note the remainder.
  2. Replace the larger number with the smaller one, and the smaller one with the remainder.
  3. Repeat until the remainder is 0. The last divisor is the GCF.

Take 1071 and 462:

  • 1071 = 2 × 462 + 147
  • 462 = 3 × 147 + 21
  • 147 = 7 × 21 + 0

The remainder is 0 after the division by 21, so GCF(1071, 462) = 21.

To check, 1071 ÷ 21 = 51 and 462 ÷ 21 = 22. 51 = 3 × 17 and 22 = 2 × 11 have no common factor other than 1, so nothing larger than 21 divides both numbers.

Three divisions found the answer. Listing the factors of 1071 by hand means testing every number from 1 to 32. For large numbers, this is the method to use, and it's the method the calculator uses to find the GCF itself. The calculator writes each division in the same form, a = quotient × b + remainder.

The GCF of three or more numbers

Find the GCF of the first two numbers, then the GCF of that result and the next number, and carry on to the last one.

Take 24, 36 and 54:

  1. GCF(24, 36) = 12, because 36 = 1 × 24 + 12 and 24 = 2 × 12 + 0.
  2. GCF(12, 54) = 6, because 54 = 4 × 12 + 6 and 12 = 2 × 6 + 0.

So GCF(24, 36, 54) = 6. The third number lowered the GCF from 12 to 6.

Prime factorization gives the same answer. 24 = 2³ × 3, 36 = 2² × 3² and 54 = 2 × 3³. All three contain 2 and 3, and the smallest powers are 2¹ and 3¹, so the GCF is 2 × 3 = 6.

The GCF of three numbers can be 1 even when every pair of them shares a factor. 6 and 10 share 2, 10 and 15 share 5, and 6 and 15 share 3. No number other than 1 divides all three, so GCF(6, 10, 15) = 1.

The calculator takes two or more numbers, separated by commas or spaces, and works them the same way, two at a time. For up to 10 numbers it shows the divisions for each pair.

GCF × LCM = a × b

For two numbers, the GCF and the least common multiple (LCM) are linked:

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

For 36 and 48, 36 × 48 = 1,728. The GCF is 12, so the LCM is 1,728 ÷ 12 = 144. To check, 144 ÷ 36 = 4 and 144 ÷ 48 = 3.

For 540 and 252, 540 × 252 = 136,080. The GCF is 36, so the LCM is 136,080 ÷ 36 = 3,780.

This rule holds for two numbers only. For 6, 10 and 15, the GCF is 1 and the LCM is 30, so GCF × LCM = 30. The product of the three numbers is 6 × 10 × 15 = 900. For three or more numbers, work out the LCM directly. The LCM calculator takes two or more numbers.

Using the GCF to simplify fractions

Divide the top and bottom of a fraction by their GCF and the fraction is in lowest terms in one step. For 252/540, the GCF is 36. 252 ÷ 36 = 7 and 540 ÷ 36 = 15, so 252/540 = 7/15.

Dividing by a smaller common factor also works, but then you have to divide again. Dividing 252/540 by 4 gives 63/135, which still shares 9.

Mistakes that give the wrong GCF

Taking the largest power of a shared prime. For 540 and 252, using 3³ instead of 3² gives 4 × 27 = 108, and 108 doesn't divide 252.

Multiplying in primes that only one number has. 5 divides 540 but not 252, so it has no place in their GCF.

Mixing up the GCF and the LCM. The GCF is never larger than the smallest number. The LCM is never smaller than the largest one. For 36 and 48, an answer above 36 can't be the GCF.

Stopping the list too early. If you list factors of 48 only up to 6, you miss 8, 12, 16 and 24. Writing each factor with its partner catches the large ones.

Check your answer with the calculator

Type your numbers into the GCF calculator, separated by commas or spaces, and press Find GCF. It shows the GCF and every common factor. Under the result, it lists the factors of each number with the common ones highlighted, writes each number as a product of primes, and runs Euclid's algorithm division by division. You can compare it line by line with your own working. To see the factors of a single number, use the factor calculator. To add or divide fractions and get the answer in lowest terms, use the fraction calculator.

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.