Skip to content
thecalculatorstudio

Prime Factorization Calculator with Factor Tree

Enter a whole number. You will see its prime factorization in exponent form and written out, the division steps, a factor tree, and how many factors the number has.

Last reviewed

Prime factorization of 360

2³ × 3² × 5

2 × 2 × 2 × 3 × 3 × 5

Prime or composite
composite
Distinct primes
3
Largest prime factor
5
Number of factors
24

Divide by the smallest prime each time

  1. 360 ÷ 2 = 180
  2. 180 ÷ 2 = 90
  3. 90 ÷ 2 = 45
  4. 45 ÷ 3 = 15
  5. 15 ÷ 3 = 5
  6. 5 ÷ 5 = 1

Factor tree

  • 360
    • 2
    • 180
      • 2
      • 90
        • 2
        • 45
          • 3
          • 15
            • 3
            • 5

Every whole number above 1 has exactly one prime factorization, apart from the order of the factors. The primes at the ends of the tree are shaded.

What prime factorization is

A prime number has exactly two factors, 1 and itself: 2, 3, 5, 7, 11, 13, 97. Every other whole number above 1 is composite, which means it can be built by multiplying primes. Prime factorization writes a number as that product:

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

The factorization is unique: whatever route you take to find it, a number has only one set of prime factors, up to the order. This is the fundamental theorem of arithmetic, and it is why primes are called the building blocks of the whole numbers.

How to find the prime factors

Divide by the smallest prime that goes in, again and again, until you reach 1.

Step Division Result
1 360 ÷ 2 180
2 180 ÷ 2 90
3 90 ÷ 2 45
4 45 ÷ 3 15
5 15 ÷ 3 5
6 5 ÷ 5 1

The divisors used (2, 2, 2, 3, 3, 5) are the prime factors. Try 2 first, then 3, then 5, 7, 11 and so on, only primes needing to be tried. You can stop once the divisor squared is larger than what is left, because then the remainder is itself prime. That is why even a very large number can be tested in a moment.

The factor tree

A factor tree shows the same process as a picture. Split the number into any two factors, then split each factor that is not prime, and stop when every branch ends in a prime. For 12:

  • 12 splits into 2 and 6.
  • 6 splits into 2 and 3.
  • The ends of the branches are 2, 2 and 3, so 12 = 2 × 2 × 3.

You could also split 12 as 3 × 4 and 4 as 2 × 2, and you get the same primes. The page draws one tree, always splitting off the smallest prime, with the primes shaded.

Worked examples

360 = 2³ × 3² × 5. Six divisions, and 24 factors (4 × 3 × 2).

97. Try 2, 3, 5, 7. Since 11 × 11 is already more than 97, nothing else needs testing, and none divides 97, so 97 is prime.

1,024 = 2¹⁰, ten divisions by 2.

600,851,475,143 = 71 × 839 × 1,471 × 6,857. A long number with a short answer: its largest prime factor is 6,857. This number is the subject of a well-known programming exercise, and the page factors it instantly.

1,000,000,000,000,000 (a quadrillion) = 2¹⁵ × 5¹⁵, with 16 × 16 = 256 factors.

What you can do with the factorization

  • Count the factors. Add 1 to each exponent and multiply: 360 has (3+1)(2+1)(1+1) = 24. See the factor calculator for the full list.
  • Find the greatest common factor. Take each prime shared by both numbers to the lower exponent. For 360 and 84 = 2² × 3 × 7: 2² × 3 = 12. The greatest common factor calculator does this.
  • Find the least common multiple. Take every prime to the higher exponent: 2³ × 3² × 5 × 7 = 2,520. See the least common multiple calculator.
  • Simplify fractions and roots. Cancel shared primes in a fraction, or take pairs out of a square root: √360 = √(2² × 2 × 3² × 5) = 6√10.
  • Test for a perfect square or cube. A number is a perfect square when every exponent is even.

Why 1 is not prime

If 1 counted as prime, factorizations would stop being unique, because you could multiply by 1 as many times as you like: 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3. So 1 is neither prime nor composite, and the page says “1 has no prime factors”.

Common mistakes

  • Stopping at a composite factor. 360 = 6 × 60 is not a prime factorization. Keep splitting until every factor is prime.
  • Treating 1 as a prime. It is not.
  • Missing a repeated prime. 12 = 2 × 2 × 3, not 2 × 3 × 3.
  • Testing too many divisors. Only primes up to the square root of the remainder need testing.
  • Confusing prime factors with all factors. 12’s prime factors are 2 and 3, but its factors are 1, 2, 3, 4, 6 and 12.
  • Factor calculator, for all the factors and factor pairs.
  • Greatest common factor calculator and least common multiple calculator.
  • Common factor calculator and fraction calculator.
  • Root calculator, which uses prime factors to simplify radicals.

How it is calculated

The number is divided by 2, then by each odd number 3, 5, 7 and so on, while the divisor squared is no more than what is left. Each time a divisor goes in, it is recorded as a step and the quotient continues. What remains at the end, if it is greater than 1, is a prime. The number of factors is the product of (exponent + 1). The factor tree splits the number into its smallest prime and the cofactor, and repeats on the cofactor. It is exact for every whole number from 1 to a quadrillion.

Frequently asked questions

What is prime factorization?

Writing a number as a product of prime numbers. 360 = 2 × 2 × 2 × 3 × 3 × 5, or 2³ × 3² × 5 in exponent form. Every whole number above 1 has exactly one such factorization, apart from the order.

How do I find the prime factors of a number?

Divide by 2 as many times as it goes, then by 3, then by each next number that still divides, until the quotient is 1. For 360: ÷2 → 180, ÷2 → 90, ÷2 → 45, ÷3 → 15, ÷3 → 5, ÷5 → 1.

What is a factor tree?

A diagram that splits a number into two factors, then splits each factor that is not prime, until every branch ends in a prime. The primes at the ends are the prime factorization. Different trees give the same primes.

What is a prime number?

A whole number greater than 1 that has no factors except 1 and itself, such as 2, 3, 5, 7, 11 and 97. A number that is not prime, and not 1, is composite.

How do I know how many factors a number has?

Add 1 to each exponent in the prime factorization and multiply. 360 = 2³ × 3² × 5 gives (3+1)(2+1)(1+1) = 24.

How large a number can it handle?

Up to 1,000,000,000,000,000 (a quadrillion). It uses trial division up to the square root, which is exact, and for a number that is itself prime in that range it still answers quickly.

Related calculators

Sources