Prime Factorization Calculator
Break a whole number into a product of primes. The calculator also tells you whether it is prime and gives the number, sum and list of its divisors.
What is prime factorization?
Prime factorization writes a whole number as a product of prime numbers (whole numbers of 2 or more whose only divisors are 1 and themselves). For example, 360 = 2³ × 3² × 5. Apart from the order of the factors, the factorization of a number is unique.
Number and sum of divisors
If the factorization is p₁^e₁ × p₂^e₂ × …, then
- number of divisors = (e₁ + 1) × (e₂ + 1) × …
- sum of divisors = (p₁^(e₁+1) − 1) ÷ (p₁ − 1) × (p₂^(e₂+1) − 1) ÷ (p₂ − 1) × … (including the number itself)
For 360 = 2³ × 3² × 5, the number of divisors is (3 + 1) × (2 + 1) × (1 + 1) = 24, and their sum is 15 × 13 × 6 = 1,170.
How it works, and the limit
The calculator uses trial division: it tests 2, 3 and then numbers of the form 6k ± 1, up to the square root of the number. The number can have up to 12 digits (999,999,999,999). Trial division gets much slower as numbers grow, so the limit is deliberate. Within 12 digits, even the hardest cases finish almost instantly.
The list of divisors shows the first 1,000 and offers a "Show all" button for the rest. A number with up to 12 digits has at most 6,720 divisors. The copy button always copies every divisor.
Special cases
- 1 is neither prime nor composite. Its factorization is empty (just 1) and it has one divisor, 1.
- The factorization of a prime is the number itself (two divisors: 1 and the number).
- 0, negative numbers and decimals are not accepted.
Examples
| Input | Result |
|---|---|
| 360 | 2³ × 3² × 5; 24 divisors, sum 1,170 |
| 97 | Prime; 2 divisors (1 and 97), sum 98 |
| 999,999,999,999 | 3³ × 7 × 11 × 13 × 37 × 101 × 9901 |
| 999,999,999,989 | Prime (the largest prime with 12 digits or fewer) |
What this calculator does not do
It does not handle numbers of more than 12 digits, primality tests for very large numbers, perfect numbers, Euler's totient function, or lists of primes. For the greatest common divisor and least common multiple of several numbers, use the GCD & LCM Calculator; to reduce a fraction, use the Fraction Calculator.
Frequently asked questions
Is 1 a prime number?
No. A prime number is a whole number of 2 or more that has exactly two divisors, 1 and itself.
Is the prime factorization of a number unique?
Yes, apart from the order in which the factors are written.
Will a large number take a long time?
Numbers are limited to 12 digits, so results appear almost immediately.