Math Tools Math Tools

How to Find Prime Factors

How to Find Prime Factors

By Math Tools ·

How to Find Prime Factors

How many numbers divide evenly into 360? You could test every number from 1 to 360 and count. Or you could find its prime factorization, 2³ × 3² × 5, and get the answer in one line: (3 + 1) × (2 + 1) × (1 + 1) = 24.

Prime factors are the "atoms" of whole numbers. Finding them unlocks shortcuts for simplifying fractions, finding common denominators and counting divisors, and understanding them explains why some of the world's encryption is secure. Here's how to find them.


Every Number Has Exactly One Prime Factorization

You can split 360 in many ways: 36 × 10, 8 × 45, 4 × 90. It seems like different starting points should lead to different sets of primes.

They never do. The fundamental theorem of arithmetic guarantees that every whole number greater than 1 breaks down into primes in exactly one way, apart from the order. No matter how you start, 360 always ends up as 2 × 2 × 2 × 3 × 3 × 5.


First: What's a Prime?

A prime number has exactly two divisors: 1 and itself. The first few are:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47

1 is not prime. Keep the list of prime numbers handy while factoring. See What Makes a Number Prime?


Method 1: The Factor Tree

Split the number into any two factors, then keep splitting until every branch ends in a prime.

Example: 360

            360
           /   \
         36     10
        /  \   /  \
       6    6 2    5
      / \  / \
     2   3 2  3

The prime "leaves" are 2, 3, 2, 3, 2 and 5. Sorted:

360 = 2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5

Method 2: Repeated Division

Divide by the smallest prime that works, and repeat with the result.

Example: 360

Divide Result
360 ÷ 2 180
180 ÷ 2 90
90 ÷ 2 45
45 ÷ 3 15
15 ÷ 3 5
5 ÷ 5 1

The divisors you used are the prime factors: 2³ × 3² × 5. This method is systematic and easy to check. Verify it with the prime factorization of 360.


Divisibility Shortcuts

Quick tests tell you which primes to try:

Prime Divides n if…
2 the last digit is even
3 the sum of the digits is divisible by 3
5 the last digit is 0 or 5
7 double the last digit, subtract from the rest; the result is divisible by 7
11 the alternating sum of digits is divisible by 11

Stop at the square root. If no prime up to √n divides n, then n itself is prime. For 1001, √1001 ≈ 31.6, and trial division quickly finds 1001 = 7 × 11 × 13. See 1001's factorization.


Method 3: Fermat's Difference of Squares

When a number's two factors are close together, there's a faster trick. It uses the identity:

a² − b² = (a − b)(a + b)

Example: 5959

  1. √5959 ≈ 77.2, so start with a = 78.
  2. Try a² − 5959 until you get a perfect square:
    • 78² − 5959 = 125 (no)
    • 79² − 5959 = 282 (no)
    • 80² − 5959 = 441 = 21² (yes)
  3. So 5959 = (80 − 21)(80 + 21) = 59 × 101.

Both are prime, so we're done. Check it with the prime factorization of 5959.


An Insider Reference: Fermat's Letter and Modern Factoring

Pierre de Fermat described this difference-of-squares method in a letter around 1643, using it to factor a 10-digit number, 2,027,651,281, by hand. See Pierre de Fermat.

Modern factoring algorithms, like the quadratic sieve (Carl Pomerance, 1981) and the general number field sieve, are sophisticated descendants of Fermat's idea: find two squares whose difference is a multiple of n. Even so, factoring huge numbers remains so hard that it protects RSA encryption. A 617-digit RSA modulus is far beyond any known method. See Why Prime Numbers Matter to Modern Cryptography.


Using a Prime Factorization

Count Divisors

If n = p₁^a × p₂^b × p₃^c, the number of divisors is (a + 1)(b + 1)(c + 1). For 360 = 2³ × 3² × 5¹: 4 × 3 × 2 = 24 divisors.

Find the GCF and LCM

Compare factorizations: the GCF uses the lowest power of each shared prime, and the LCM uses the highest power of every prime. See How to Find the Greatest Common Factor.

Simplify Square Roots

√360 = √(2² × 3² × 2 × 5) = 2 × 3 × √10 = 6√10.


Two Concepts Worth Knowing

Composite Number

A composite number has more divisors than 1 and itself, so it can be factored into smaller primes. Browse the composite numbers list.

Exponent Notation

Writing repeated prime factors with exponents, like 2³ instead of 2 × 2 × 2, keeps factorizations compact and makes divisor counting easy.


Quick Answer: How Do You Find Prime Factors?

Divide the number by the smallest prime that divides it evenly, then repeat with the result until you reach 1. The primes you divided by are the prime factors. For 360: ÷2 → 180, ÷2 → 90, ÷2 → 45, ÷3 → 15, ÷3 → 5, ÷5 → 1, so 360 = 2³ × 3² × 5. You only need to test primes up to the square root.


Try Them Yourself

Factor the current year using repeated division. Then count its divisors with the (a + 1)(b + 1) formula, and check your count by listing them.