Prime Factorization

Watch the video explainer

Learning goals

  • Build a factor tree until every leaf is prime
  • Divide repeatedly by the smallest prime that fits, using the divisibility rules to move fast
  • Collect repeated primes into prime-power form
  • Explain why the starting split never changes the final list of primes

What a prime factorization is

A prime factorization of a whole number greater than 11 is a way of writing it as a product of prime numbers only. For example,

12=2×2×3,30=2×3×5,7=7.12 = 2 \times 2 \times 3, \qquad 30 = 2 \times 3 \times 5, \qquad 7 = 7.

Every factor on the right is prime. A composite number such as 1212 splits into several primes; an already-prime number such as 77 is its own prime factorization. Stop only when every factor is prime, not merely when you have found a factor pair.

A list of factors is something different. The factors of 1212 are 1,2,3,4,6,121,2,3,4,6,12. Its prime factorization is 2×2×32\times2\times3: it tells you which primes to multiply, including repeated copies. So the factor list gives the divisors, and the prime factorization gives a multiplication recipe.

Every number breaks down into primes

Every whole number greater than 11 can be written as a product of primes. For 6060, begin with 6×106\times10, then split both composite pieces:

60=(2×3)×(2×5).60=(2\times3)\times(2\times5).

Each split replaces a composite with smaller factors greater than 11. They cannot shrink forever, since none drops below 22. Splitting can stop only when no piece can split further, so every piece left is prime.

We still need to ask whether different starting splits can produce different prime lists.

The factor-tree method

A factor tree records each split as two branches. If the number is already prime, its factorization is complete. Otherwise, write it at the top and split it into two factors greater than 11 whose product is that number. Split each composite factor again; stop and circle each prime. The primes at the ends of the branches are the leaves. Multiply those leaves to recover the starting number.

Take 3636. One natural split is 36=4×936 = 4 \times 9. Neither 44 nor 99 is prime, so each splits again: 4=2×24 = 2 \times 2 and 9=3×39 = 3 \times 3. Now every leaf is prime, so we are finished.

A factor tree for 36, split first as 4 x 9. Each composite branch splits again until every leaf (highlighted) is prime. A factor tree that splits 36 down to its prime factors. 2 2 4 3 3 9 36
A factor tree for 36, split first as 4 x 9. Each composite branch splits again until every leaf (highlighted) is prime.

Reading the leaves from left to right gives

36=2×2×3×3.36 = 2 \times 2 \times 3 \times 3.

It does not matter which factor you write first or which branch you split first. As long as you keep going until every leaf is prime, the leaves you collect are the prime factorization.

Now try building one yourself. Start 4848 as 48=6×848 = 6 \times 8, and split each branch until every leaf is prime.

Check your understanding

Finish the factor tree for 4848, starting from 48=6×848 = 6 \times 8. What are the prime leaves?

Answer choices

Repeated multiplication in exponent form

Repeated primes can be written more compactly. The factorization of 3636 has two 22s and two 33s. Write 2×22\times2 as 222^2. The small raised number is the exponent: it counts the copies being multiplied. So 232^3 means 2×2×22\times2\times2, not 2×32\times3.

23=2×2×2=8,32=3×3=9.2^3 = 2 \times 2 \times 2 = 8, \qquad 3^2 = 3 \times 3 = 9.

Using this, the factorization of 3636 becomes

36=2×2×3×3=22×32.36 = 2 \times 2 \times 3 \times 3 = 2^2 \times 3^2.

This is prime-power form: write each distinct prime once, with an exponent counting its copies. List the primes from smallest to largest. A single copy needs no written exponent. You can expand a power to check the count whenever needed.

Check your understanding

Which of these is the prime factorization of 2424 in prime-power form?

Answer choices

Repeated division by primes

Repeated division by primes records the same factors in a single column. Divide by the smallest prime that fits, then do the same to the quotient. When the quotient reaches 11, stop. The divisors you used multiply to the original number.

Run this on 360360. The smallest prime dividing it is 22, and you keep dividing by 22 as long as the result stays even:

360÷2=180,180÷2=90,90÷2=45.360 \div 2 = 180, \quad 180 \div 2 = 90, \quad 90 \div 2 = 45.

Now 4545 is odd, so 22 is finished. The smallest prime that divides 4545 is 33:

45÷3=15,15÷3=5.45 \div 3 = 15, \quad 15 \div 3 = 5.

Finally 55 is prime and divides itself: 5÷5=15 \div 5 = 1. We have reached 11, so we stop. The divisors, in the order we used them, were 2,2,2,3,3,52, 2, 2, 3, 3, 5, so

360=23×32×5.360 = 2^3 \times 3^2 \times 5.

The divisibility rules from earlier in this chapter make each step quick. They tell you at a glance whether 22, 33, or 55 divides the current number, so you rarely have to guess.

The prime factorization also gives you factor pairs. Regroup the primes of 360360 into two groups and you get a factor pair for free: (2×32)×(22×5)=18×20(2 \times 3^2) \times (2^2 \times 5) = 18 \times 20, so 360=18×20360 = 18 \times 20. Finding that pair by guessing would take longer than reading it off the factorization. The next lesson uses this same idea to find the greatest common factor and least common multiple of two numbers.

Worked example 1 Find the prime factorization of 8484

Use repeated division, always dividing by the smallest prime that fits.

The number 8484 is even, so start with 22:

84÷2=42,42÷2=21.84 \div 2 = 42, \qquad 42 \div 2 = 21.

Now 2121 is odd, so 22 is done. Its digit sum is 2+1=32 + 1 = 3, a multiple of 33, so divide by 33:

21÷3=7.21 \div 3 = 7.

The quotient 77 is prime, so the last step is 7÷7=17 \div 7 = 1. Collecting the divisors 2,2,3,72, 2, 3, 7 and grouping the repeats,

84=2×2×3×7=22×3×7.84 = 2 \times 2 \times 3 \times 7 = 2^2 \times 3 \times 7.

A prime that appears only once, like the 33 and the 77 here, is written with no exponent (an exponent of 11 is understood). As a check, multiply the factorization back out: 22×3×7=4×3×7=842^2 \times 3 \times 7 = 4 \times 3 \times 7 = 84, the number we started with.

The Fundamental Theorem of Arithmetic

We saw that 3636 could be started as 4×94 \times 9. But you could just as well start it as 6×66 \times 6, or as 2×182 \times 18. Do those other starting splits change the final answer?

Two factor trees for 36 reach the same primesThe left tree splits 36 as 4 times 9; the right tree splits 36 as 6 times 6. Both end in the prime leaves 2, 2, 3, 3.start with 4 x 9start with 6 x 63649223336662323both give 2 x 2 x 3 x 3
Two different factor trees for 36. The left starts 4 x 9, the right starts 6 x 6. The starting splits differ, but the leaves at the bottom are the same four primes: two 2s and two 3s.

Both trees end with two 22s and two 33s. Their order changes, but their numbers and counts agree. This is true for every whole number greater than 11:

The Fundamental Theorem of Arithmetic says that each such number has exactly one prime factorization, apart from order. Any correct tree that finishes at primes must reach that same list.

Why is the answer always the same? The reason is a special fact about primes: if a prime divides a product of two numbers, it must divide at least one of them. Take 33 and 2×6=122 \times 6 = 12: the 33 shows up in the 66. This is true of every prime. A composite number need not behave this way: 44 divides 2×6=122 \times 6 = 12, but 44 divides neither 22 nor 66.

Because of this fact, every prime in one list has to match a prime in the other, so neither list can hold anything the other is missing.

Check your understanding

Maria splits 7272 as 8×98 \times 9, and Jon splits it as 6×126 \times 12. Whose final list of prime factors is correct?

Answer choices

Check your understanding

Why must different completed factor trees for 7070 give the same primes, 22, 55, and 77?

Answer choices

Larger numbers, same method

Bigger numbers use the same method, though they can take more steps. Peel off the small primes first using the divisibility rules, which shrinks the number fast and keeps the arithmetic light, as in the 360360 example above. But sometimes none of the small primes fit at all, and you have to work upward.

Worked example 2 Find the prime factorization of 539539

Use the divisibility rules to cross off the small primes, then test the next ones in turn.

The number 539539 is odd, so 22 is out. Its digit sum is 5+3+9=175 + 3 + 9 = 17, not a multiple of 33, so 33 is out. It does not end in 00 or 55, so 55 is out. The next prime is 77:

539÷7=77.539 \div 7 = 77.

So 77 works, and now factor the quotient 7777. It is 7×117 \times 11:

77÷7=11,11÷11=1.77 \div 7 = 11, \quad 11 \div 11 = 1.

Both 77 and 1111 are prime, so the factorization is

539=7×7×11=72×11.539 = 7 \times 7 \times 11 = 7^2 \times 11.

When the small primes all fail, work upward through 7,11,13,…7, 11, 13, \ldots, and remember the stopping rule from the last lesson: keep testing primes only while the prime times itself is at most the number you are testing. Once every prime up to that point has failed, what remains is itself prime.

Check your understanding

Using the smallest prime that fits at each step, which division record correctly factors 9090?

Answer choices

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

Go deeper (optional)

You can skip this and keep going. Read it if you want to know more.

Why the splitting always finishes

Why every whole number greater than 11 is a product of primes#

Follow 126126: split it into 2×632\times63, then split 6363 into 7×97\times9, and 99 into 3×33\times3. This gives 126=2×7×3×3126=2\times7\times3\times3. Along each branch the numbers decrease, and no factor falls below 22.

For any whole number n>1n>1, either nn is prime or it has a factor pair a×ba\times b with both factors greater than 11. In the prime case, it is already a product consisting of one prime. In the composite case, both factors are smaller than nn. Split any composite factors again.

Along a branch, the whole numbers strictly decrease and stay at least 22, so that branch has only finitely many splits. There are at most two branches from each split and a bounded number of steps down any branch, so the entire tree is finite. A composite cannot be an unfinished end, because it still has a factor pair to split. Therefore a completed tree has only prime leaves, whose product is nn.

Why the answer cannot depend on how you split the number

This argument uses the fact stated in the lesson: a prime dividing a product divides at least one factor. That fact, called Euclid’s lemma, is the starting point here; this is not a proof of the lemma itself.

The idea behind uniqueness#

The prime list for 6060 is 2,2,3,52,2,3,5. Suppose a second list of primes also multiplies to 6060. The 55 divides their product, so it divides one prime in that list. That prime must itself be 55. Remove a 55 from each list; both remaining products are 1212. Match the 33 next, then each 22. The second list has exactly the same primes.

For any whole number greater than 11, suppose two different prime lists gave the same product. Choose a prime pp from the first. It divides the first product, which equals the second product, so it also divides the second. Repeatedly applying the prime-product fact shows that pp divides one prime in the second list. One prime divides another only when they are equal, so the two lists have a matching pp.

Divide both products by pp and repeat. The lists are finite, so this matching process ends. When the first list runs out, its remaining product is 11, meaning no factors remain. The second product must also be 11; it cannot contain any prime, since every prime is at least 22. The lists therefore match in every prime and every count, contradicting the claim that they differed.

A bit of history (optional)

In the 1840s, Ernst Kummer studied number systems larger than the ordinary integers. Splitting numbers into smaller factors still made sense there, but unique factorization could fail: one number could split into two different collections of pieces that could not be split further. These pieces need not have the prime-divides-a-product property of ordinary primes.

Kummer published an example of this failure in 1844. By 1846 he had introduced what he called ideal complex numbers, new mathematical objects that restored a form of unique factorization.

His work later helped with Fermat’s Last Theorem, a famous problem about whole-number powers. A popular story says Kummer invented his ideal numbers to repair Lamé’s failed 1847 proof of that theorem. MacTutor’s history of ring theory calls that origin story almost certainly false: Kummer had introduced those ideas in 1846, before Lamé announced that proof.

Your progress

See all your progress →