Introduction

Welcome back to Finding the Highest Common Factor! You are now on Lesson 3 of 4 in this course, which means you have already built a solid foundation. In the first two lessons, we identified common factors by listing and comparing factor lists, then selected the greatest one to find the HCF. That approach is reliable, but it can get slow when numbers grow larger.

In this lesson, we will learn a more efficient route: finding the HCF directly from the prime factorizations of the numbers involved. If you completed the earlier course on breaking numbers into primes, those skills are about to pay off in a big way.

From Factor Lists to Prime Factors

Listing every factor of a number works well for small values like 1212 or 1818. But imagine finding all the factors of 252252 or 360360 — the lists get long, and mistakes become easy to make.

Prime factorization gives us a shortcut because it breaks each number down to its basic building blocks. As you may recall from a previous course, every whole number greater than 11 has a unique prime factorization. Comparing those building blocks tells us exactly what two numbers have in common, without writing out every single factor. The core idea is simple: if a prime appears in both factorizations, it contributes to the HCF; if it appears in only one, it does not.

The Method: Shared Primes at Their Lowest Powers

Here is the step-by-step process for finding the HCF using prime factorization:

  1. Find the prime factorization of each number.
  2. Identify the primes that appear in every factorization (the shared primes).
  3. For each shared prime, take the lowest power that appears across the factorizations.
  4. Multiply these together to get the HCF.

If no prime is shared at all, the HCF is simply 11. As we saw in the previous lesson, that just means the numbers are coprime.

Flowchart showing the four-step process for finding HCF using prime factorization
Worked Example: HCF of 36 and 48

Let's see the method in action. First, we write the prime factorizations:

36=22×3236 = 2^2 \times 3^2 48=24×348 = 2^4 \times 3
Why Only Shared Primes Count

You might wonder why we ignore a prime that appears in only one factorization. The reason comes straight from the definition of "factor." For a number to divide both values evenly, every prime in that number must be present in both factorizations. A prime that is missing from one side simply cannot be part of any common factor.

Let's explore this with 6060 and 9090:

60=22×3×560 = 2^2 \times 3 \times 5
Why the Lowest Power?

It is also worth understanding why we pick the lowest power of each shared prime, not the highest. Look at the prime 22 in the example above: it appears as 222^2 in 6060 and as 212^1 in . If we tried to include in the HCF, the result would contain a factor of . But is not divisible by , so a number containing could not divide evenly.

Extending to Three Numbers

The method works the same way with three or more numbers. A prime must appear in all factorizations to be included, and we still take the lowest power across the entire set. Let's find the HCF of 2424, 3636, and 6060:

24=23×324 = 2^3 \times 3
When This Method Really Shines

For small numbers, listing factors and comparing them is perfectly fine. The prime factorization method shows its true strength with larger numbers, where full factor lists would be long and error-prone. Consider finding the HCF of 168168 and 252252:

168=23×3×7168 = 2^3 \times 3 \times 7
Conclusion and Next Steps

In this lesson, we learned how to find the HCF by comparing prime factorizations rather than full factor lists. The process comes down to three ideas: identify the primes shared by all numbers, take each shared prime at its lowest appearing power, and multiply. We also explored why primes found in only one factorization are left out and why higher powers of shared primes cannot be used, since including them would produce a number that no longer divides every value in the set.

Now it is time to put this method into practice! The upcoming exercises will walk you through guided fill-in-the-blank examples first, then challenge you with larger numbers and sets of three, so you can build real confidence with this powerful technique.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal