Numbers & Arithmetic

Prime Factorization: How to Find It, Check It and Use It

Prime factorization writes a whole number greater than 1 as a product of primes, such as 360=23×32×5360 = 2^3 \times 3^2 \times 5. Every such number has exactly one prime factorization, apart from the order of the factors.

n=p1a1⋅p2a2⋯pkakn = p_1^{a_1} \cdot p_2^{a_2} \cdots p_k^{a_k}

Try it with your numbers

Show every step

That single guarantee is why the idea is worth learning. It lets you find a greatest common factor, simplify a fraction or a root, count divisors and test for perfect squares from one short line of primes. The sections below show how to find the factorization quickly, how to know you are finished, and what to do with the result.

What is prime factorization, and why is it unique?

A prime is a whole number greater than 1 whose only positive factors are 1 and itself. The first few are 2,3,5,7,11,132, 3, 5, 7, 11, 13, and the full run up to 100 is on the prime numbers from 1 to 100 page. Every other whole number above 1 is composite, which means it splits into two smaller whole numbers. Splitting cannot go on forever because the pieces keep shrinking, so every composite number eventually turns into a product of primes.

Uniqueness is the part that needs an argument. It is called the fundamental theorem of arithmetic, and it rests on one fact: if a prime pp divides a product abab, then pp divides aa or pp divides bb. Suppose a number had two different prime factorizations. A prime on one side would have to divide something on the other side, so it would equal one of those primes. Cancel that pair and repeat, and the two lists turn out to be identical.

Why 1 is not prime

If 1 counted as prime, then 6=2×3=1×2×36 = 2 \times 3 = 1 \times 2 \times 3 would be two different factorizations. Excluding 1 is what keeps uniqueness true.

Uniqueness is not automatic in every number system. In the set of numbers of the form a+b−5a + b\sqrt{-5}, you get 6=2⋅3=(1+−5)(1−−5)6 = 2 \cdot 3 = (1+\sqrt{-5})(1-\sqrt{-5}), and none of those four factors can be split further. Ordinary whole numbers are unusually well behaved, which is why the method in this lesson never gives two answers.

Quick check

A student writes 48=6×848 = 6 \times 8 as its prime factorization. What is the correct prime factorization?

How do you find the prime factorization of a number?

The division method is a fixed routine that cannot go wrong if you follow it.

  1. Divide by the smallest prime, 2, as many times as it goes in evenly.
  2. When 2 fails, move to 3, then 5, then 7, then 11, always using the current quotient.
  3. Stop when the quotient reaches 1. The divisors you used are the prime factors.

Here it is on 360360:

360÷2=180,180÷2=90,90÷2=45,45÷3=15,15÷3=5,5÷5=1360 \div 2 = 180,\quad 180 \div 2 = 90,\quad 90 \div 2 = 45,\quad 45 \div 3 = 15,\quad 15 \div 3 = 5,\quad 5 \div 5 = 1

The divisors used were 2,2,2,3,3,52, 2, 2, 3, 3, 5, so

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

The divisibility rules make each trial instant: even numbers pass the 2 test, a number passes the 3 test when its digit sum does (for 4545, 4+5=94 + 5 = 9), and a last digit of 0 or 5 means 5 divides it. Going in increasing order has a built-in benefit. Once 2 stops dividing the current quotient, it never divides it again, so you never look backward.

The classic trap is stopping too early. Writing 360=6×60360 = 6 \times 60 looks finished but contains composite numbers. A factorization is complete only when every factor is prime, and the exponent form is the tidy way to show it.

Factor tree or division method: which is faster?

Both reach the same primes, so the choice is about speed and habit. A factor tree lets you start with any factor pair you can see, which is quicker when a number has an obvious large factor. The division method is better when nothing jumps out, because it forces a search order and never leaves a composite leaf behind.

Method Best when Weak spot
Division (ladder) The number is large or has no obvious factors Slow if a big factor pair is staring at you
Factor tree You can spot a big factor pair quickly Easy to leave a composite number on a branch

Take 840840. One tree starts with 840=8×105840 = 8 \times 105. Then 8=238 = 2^3 and 105=3×35=3×5×7105 = 3 \times 35 = 3 \times 5 \times 7, which gives 23×3×5×72^3 \times 3 \times 5 \times 7. A different tree starts with 840=20×42840 = 20 \times 42. Then 20=22×520 = 2^2 \times 5 and 42=2×3×742 = 2 \times 3 \times 7, and combining gives

840=23×3×5×7.840 = 2^3 \times 3 \times 5 \times 7.

Different trees, identical result. Uniqueness works as an error alarm: if two routes disagree, one contains an arithmetic slip.

Ending in zero? Peel off 10 first

Every trailing zero hides a 22 and a 55. For example, 4500=45×100=32×5×22×52=22×32×534500 = 45 \times 100 = 3^2 \times 5 \times 2^2 \times 5^2 = 2^2 \times 3^2 \times 5^3.

When can you stop testing primes?

Number line showing 391 equals 17 times 23 with factors on either side of square root of 391
Since 17 is below the square root of 391 (about 19.8), testing primes up to 19 finds the pair 17 × 23.

You only need to test primes up to n\sqrt{n}. The reason is one clean idea: if n=abn = ab with a≤ba \le b, then a2≤ab=na^2 \le ab = n, so the smaller factor aa is at most n\sqrt{n}. If no prime up to n\sqrt{n} divides nn, no factor pair exists and nn is prime.

Factor 391391. Since 192=36119^2 = 361 and 202=40020^2 = 400, the square root is between 19 and 20, so the primes to test are 2,3,5,7,11,13,17,192, 3, 5, 7, 11, 13, 17, 19. A list of perfect squares makes this bound easy to estimate.

  • 22: 391 is odd, so no.
  • 33: the digit sum is 1313, so no.
  • 55: the last digit is 1, so no.
  • 77: 7×55=3857 \times 55 = 385, remainder 6, so no.
  • 1111: the alternating sum 3−9+1=−53 - 9 + 1 = -5 is not a multiple of 11, so no.
  • 1313: 13×30=39013 \times 30 = 390, remainder 1, so no.
  • 1717: 17×23=39117 \times 23 = 391, so yes.

The quotient 2323 only needs testing against 2 and 3 (since 23<5\sqrt{23} < 5), and both fail, so 23 is prime. Therefore 391=17×23391 = 17 \times 23. Numbers like this catch people out because they pass every quick rule for 2, 3 and 5 yet are not prime.

Try this: Decide whether 221221 is prime. First work out which primes you must test (stop at 221\sqrt{221}), then test them one by one and multiply back to check.

Prime factorization of negative numbers, 0 and 1

Prime factorization is defined for whole numbers greater than 1, but negatives come up in algebra, and the convention is simple. Factor the absolute value, then keep the sign as a separate factor of −1-1:

−60=−1×22×3×5.-60 = -1 \times 2^2 \times 3 \times 5.

The sign follows the usual rules for multiplying integers: an odd count of negative factors gives a negative product. Here there is one factor of −1-1, so the product is negative.

The number 1 has an empty prime factorization, a product of no primes at all, in the same way an empty sum is 0. The number 0 has none: it is divisible by every prime, so there is no finite list of primes that builds it. When a problem asks you to factor 0 or 1, the honest answer is that the question does not apply.

Quick check

Write the prime factorization of −84-84.

How to use prime factorization for GCF and LCM

Exponent blocks for 84 and 90 showing GCF 6 from smaller exponents and LCM 1260 from larger
For 84 and 90, the smaller exponent of each prime gives the GCF of 6 and the larger gives the LCM of 1260.

Prime factorization turns the greatest common factor and the least common multiple into bookkeeping. Write both numbers as prime powers, with a missing prime counted as exponent 0. The GCF takes the smaller exponent of each prime, and the LCM takes the larger.

Find both for 8484 and 9090:

84=22×3×7,90=2×32×584 = 2^2 \times 3 \times 7, \qquad 90 = 2 \times 3^2 \times 5

GCF=21×31=6\text{GCF} = 2^1 \times 3^1 = 6

LCM=22×32×5×7=1260\text{LCM} = 2^2 \times 3^2 \times 5 \times 7 = 1260

Check with the identity GCF×LCM=a×b\text{GCF} \times \text{LCM} = a \times b. Here 6×1260=75606 \times 1260 = 7560 and 84×90=756084 \times 90 = 7560. The identity holds because for each prime, the smaller exponent plus the larger exponent equals the sum of the two exponents.

The same GCF simplifies fractions. Dividing top and bottom of 8490\frac{84}{90} by 6 gives 1415\frac{14}{15}, and since 14 and 15 share no prime, the fraction is fully reduced. This is the idea behind simplifying fractions: cancel shared primes and nothing else.

What the exponents in a prime factorization tell you

Once a number is in the form p1a1p2a2⋯pkakp_1^{a_1} p_2^{a_2} \cdots p_k^{a_k}, the exponents answer several questions without any more division.

The number of positive divisors is (a1+1)(a2+1)⋯(ak+1)(a_1 + 1)(a_2 + 1) \cdots (a_k + 1). Each divisor chooses an exponent from 00 up to aia_i for every prime, giving ai+1a_i + 1 choices. For 360=23×32×5360 = 2^3 \times 3^2 \times 5 this gives 4×3×2=244 \times 3 \times 2 = 24 divisors.

A number is a perfect square exactly when every exponent is even, and a perfect cube when every exponent is a multiple of 3. So 1176=23×3×721176 = 2^3 \times 3 \times 7^2 is not a square, because the exponents of 2 and 3 are odd. Even exponents also let you pull factors out of a root:

72=23×32=22×32×2=2×3×2=62.\sqrt{72} = \sqrt{2^3 \times 3^2} = \sqrt{2^2 \times 3^2 \times 2} = 2 \times 3 \times \sqrt{2} = 6\sqrt{2}.

That is the whole method behind simplifying square roots.

Trailing zeros in a factorial

Each zero at the end of 50!50! needs a 2 and a 5, and 2s are plentiful, so count the 5s: ⌊50/5⌋+⌊50/25⌋=10+2=12\lfloor 50/5 \rfloor + \lfloor 50/25 \rfloor = 10 + 2 = 12 zeros.

The factorial trick above is prime factorization in disguise: it counts how many times the prime 5 appears in the product 1×2×⋯×501 \times 2 \times \cdots \times 50.

Quick check

How many positive divisors does 100100 have?

How do you check a prime factorization?

Three checks catch nearly every error, and each takes under a minute.

  • Multiply back. The product of your prime powers must equal the original number exactly.
  • Test every factor. Each leftover factor must be prime. If it is under 100, look it up on a prime list; if larger, apply the n\sqrt{n} rule.
  • Casting out nines. A number and its digit sum leave the same remainder when divided by 9, so you can compare digit sums of the number and of the product.

Try the third check on 2024=23×11×232024 = 2^3 \times 11 \times 23. The digit sum of 2024 is 2+0+2+4=82 + 0 + 2 + 4 = 8. The factors reduce to 88, then 1+1=21 + 1 = 2, then 2+3=52 + 3 = 5, and 8×2×5=808 \times 2 \times 5 = 80, whose digit sum is 88. The two sides agree.

The nines check can miss a swapped-digit slip, which is why multiplying back remains the final word. Also confirm that the exponents count correctly: 232^3 means three 2s, not 2×32 \times 3.

Why is factoring huge numbers so hard?

Trial division needs up to n\sqrt{n} steps, which is fine for 391 and hopeless for a 617-digit number. A 2048-bit number is about 3.2×106163.2 \times 10^{616}, written compactly with scientific notation, so its square root still has over 300 digits. Faster algorithms exist, but none is fast enough to break numbers of that size on conventional computers.

That gap is the foundation of RSA encryption. Multiplying two huge primes takes a fraction of a second, while recovering them from the product is practically impossible. The difficulty is not proven mathematically, only unbroken so far. A quantum algorithm due to Peter Shor could factor large numbers efficiently in principle, which is a major reason cryptographers are designing replacements.

For homework-sized numbers, none of this matters: the division method plus the n\sqrt{n} rule always finishes. It is worth knowing, though, that the same routine you use on 360 is the one that, scaled up, holds back an entire field of computing.

Practice problems

0 of 5 solved

  1. Find the prime factorization of 6060.

  2. Find the prime factorization of 252252.

  3. Find the prime factorization of 20242024.

  4. Use prime factorizations to find the GCF and LCM of 180180 and 150150.

  5. What is the smallest positive integer nn for which 360n360n is a perfect square?

Common questions

What is prime factorization in simple terms?

It is writing a whole number greater than 1 as a product of prime numbers only. For example, 60=22×3×560 = 2^2 \times 3 \times 5. Every such number has exactly one prime factorization, ignoring the order of the factors.

What is the prime factorization of 100?

100=22×52100 = 2^2 \times 5^2. Start with 100=10×10100 = 10 \times 10, then split each 1010 into 2×52 \times 5 and collect the repeated primes as exponents.

Is 1 a prime number?

No. A prime needs exactly two positive factors, and 1 has only one. If 1 were prime, numbers would have infinitely many prime factorizations, such as 6=2×3=1×2×36 = 2 \times 3 = 1 \times 2 \times 3.

What is the difference between a factor tree and the division method?

A factor tree splits a number into any factor pair and keeps splitting. The division method divides by the smallest prime each time, in a fixed order. Both always end with the same primes.

How do you know when a number is prime?

Test whether any prime up to n\sqrt{n} divides it. If none does, nn is prime. You never need to test larger primes, because a factor pair always has one member at or below n\sqrt{n}.

How is prime factorization used to find the GCF and LCM?

Write each number as a product of prime powers. The GCF takes each shared prime with its smaller exponent, and the LCM takes every prime with its larger exponent.

Up next