Skip to content
Math & Statisticsnumber theory

Prime Factorization Calculator

The prime factorization of a number, with the divisor count computed from the exponents rather than by trial division. Comparing two factorizations shows their common factors, which is where the GCD and LCM both come from.

Also called: prime factors calculator, factorization calculator.

Prime factorization
2 x 2 x 2 x 2 x 3 x 3 x 5 x 7

5,040 = 2 x 2 x 2 x 2 x 3 x 3 x 5 x 7, which is 4 distinct primes and 60 divisors in all. The exponents give the divisor count directly: 5 x 3 x 2 x 2 = 60. A divisor is built by choosing how many copies of each prime to take, which is why 4 distinct primes produce 60 divisors. Enter a second number to see which prime factors the two share, which is where the GCD and LCM come from.

In exponent form
2^4 x 3^2 x 5 x 7
Distinct prime factors
4
Number of divisors
60
Sum of the divisors
19,344
The divisors
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 28, 30, 35, 36, 40, 42, 45, 48, 56, 60, 63, 70, 72, 80, 84, 90, 105, 112, 120, 126, 140, 144 and 20 more
Largest prime factor
7
Factors shared with the second number
Enter a second number to compare
On the structure
The exponents give the divisor count directly: 5 x 3 x 2 x 2 = 60. A divisor is built by choosing how many copies of each prime to take, which is why 4 distinct primes produce 60 divisors.
On the comparison
Enter a second number to see which prime factors the two share, which is where the GCD and LCM come from.

The factorization

PrimeExponentContributes
2416
329
515
717
Method and background

How this is calculated

Trial division by two and then by odd numbers up to the square root finds every prime factor, since any composite has a factor at or below its square root. The exponents then give the divisor count directly: multiply each exponent plus one together, because a divisor is built by choosing how many copies of each prime to include. That is why 5040, which is seven factorial, has sixty divisors from only five distinct primes. Comparing two factorizations makes the relationship between them visible: the shared primes at their lower exponents are the GCD, and at their higher exponents the LCM.

the fundamental theorem of arithmetic: every integer above one has exactly one such factorization, which is what makes the divisor count computable from the exponents alone
p
Prime factor
a
Its exponent

Worked examples

Each of these is asserted on every build. If a change to the engine ever moved one of these answers, the build would fail before the page could print it.

seven factorial

Number
5,040
Second number, to compare
0

Prime factorization2 x 2 x 2 x 2 x 3 x 3 x 5 x 7

2^4 x 3^2 x 5 x 7, so 5 x 3 x 2 x 2 divisors

Open this example

a prime factorises to itself

Number
9,973
Second number, to compare
0

Prime factorization9973

boundary: a prime has exactly two divisors

Open this example

Method and limits

What it assumes

  • Positive integers above one, since one and zero have no prime factorization.

What it deliberately does not model

  • Trial division is fast for the sizes here and hopeless for the large semiprimes cryptography relies on, which is the entire basis of RSA.

Formula version 1.0.0 · definition 1.0.0 · India · Report a problem with this calculator

Frequently asked questions

Why does a number with few prime factors have so many divisors?
Because divisors come from the exponents, not the count of distinct primes. Each exponent plus one multiplies together, so 2 to the fourth times 3 squared has fifteen divisors from two primes.
Is one a prime number?
No, by convention and for a good reason: if one were prime, factorizations would no longer be unique, since any number of ones could be included.