Prime Factorization Calculator

Write a whole number as a product of primes, in both exponent form and expanded form, with a step-by-step division table you can follow or copy into homework.

A whole number from 2 up to 1,000,000,000,000,000,000 (10^18).

Result

Prime factorization of 360
2³ × 3² × 5
  • Expanded form2 × 2 × 2 × 3 × 3 × 5
  • Exponent form (plain text)2^3 × 3^2 × 5
  • Is it prime?No, composite
  • Distinct prime factors2, 3, 5
  • Prime factors counted with repeats6
  • Number of divisors24
  • 360 = 2³ × 3² × 5. By the fundamental theorem of arithmetic this is the only way to write it as a product of primes (apart from order).
  • Divisor count: multiply each exponent plus one, (3 + 1) × (2 + 1) × (1 + 1) = 24.
Division steps: divide by the smallest prime until the quotient is 1
StepNumberDivide by primeQuotient
13602180
2180290
390245
445315
51535
6551

How to use the prime factorization calculator

Type a whole number of 2 or more. You can include commas (1,001) or use scientific notation (1e9). The result shows:

  • Exponent form, such as 2³ × 3² × 5, plus a plain-text copy (2^3 × 3^2 × 5) that pastes cleanly into an email or spreadsheet.
  • Expanded form, with every prime written out.
  • Whether the number is prime.
  • The distinct primes, how many primes there are counting repeats, and the number of divisors.
  • A division steps table showing each number, the prime it is divided by and the quotient.

The method

The fundamental theorem of arithmetic says every whole number greater than 1 is either prime or can be written as a product of primes in exactly one way. To find that product by hand:

  1. Start with the smallest prime, 2. While the number is even, divide by 2 and write 2 down.
  2. Move on to 3, then 5, 7, 11 and so on, dividing out each prime as many times as it goes in.
  3. Stop when the quotient is 1. If you reach a prime whose square is bigger than what is left, the leftover number is itself prime.

For small numbers that is exactly what the calculator does. For large ones it adds two faster tools: the Miller–Rabin test to recognise primes quickly, and Pollard’s rho method to split big composite numbers. The steps table is then rebuilt in order, smallest prime first, so it reads like hand work.

Once you have the exponents, the number of divisors is the product of each exponent plus one. That is the same rule the factor calculator uses to list every factor.

Worked example: 360

This is the example loaded when the page opens.

Step Number Divide by Quotient
1 360 2 180
2 180 2 90
3 90 2 45
4 45 3 15
5 15 3 5
6 5 5 1

Reading down the middle column gives 360 = 2 × 2 × 2 × 3 × 3 × 5, which is 2³ × 3² × 5 in exponent form. The exponents are 3, 2 and 1, so 360 has (3 + 1)(2 + 1)(1 + 1) = 24 divisors, which is why it is so convenient for dividing a circle into degrees.

A prime input such as 9,973 needs a single step: no prime up to its square root (about 99.9) divides it, so its factorization is just 9,973.

Why prime factorizations help

  • Greatest common factor: take each shared prime with its smaller exponent. The GCF calculator shows this method.
  • Least common multiple: take every prime with its larger exponent, as in the LCM calculator.
  • Simplifying roots: pairs of equal primes come out of a square root, so √360 = √(2² × 3² × 10) = 6√10.
  • Fractions: cancel the primes the numerator and denominator share.

Limitations

  • Inputs must be whole numbers from 2 to 10^18. Zero, 1, decimals and negative numbers are rejected with a short explanation. For a negative number, factor its absolute value and write −1 × in front.
  • Very large numbers made of two big primes of similar size take the longest. Near the 10^18 limit that is still usually well under a second, but it can be slower on older phones.

Frequently asked questions

What is prime factorization?

It is writing a whole number as a product of prime numbers only. For example, 360 = 2 × 2 × 2 × 3 × 3 × 5. Every whole number above 1 has exactly one such product, apart from the order of the primes.

Why can't 1 or 0 be factored?

1 is the product of no primes at all, so it has no prime factors. 0 is divisible by every prime, so there is no finite product that equals it. The calculator asks for a whole number of 2 or more.

How do I factor a negative number?

Factor its absolute value and put −1 in front. Since −360 = −1 × 360, its factorization is −1 × 2³ × 3² × 5.

How large a number can I enter?

Up to 10^18. All arithmetic uses exact whole numbers, so even values beyond the range of an ordinary spreadsheet, such as 9,007,199,254,740,993, are factored without rounding.

What does the factor tree have to do with the division table?

A factor tree splits a number into any two factors and keeps splitting. The division table always splits off the smallest prime, which is one particular tree. Both end with the same primes.

Last reviewed: