Prime Factorization Calculator
This prime factorization calculator writes any whole number from 2 to 1,000,000,000,000,000 as a product of primes, such as 360 = 2³ × 3² × 5. It also tells you whether the number is prime, shows the factor tree as a list of divisions, and counts and lists its divisors. Use it to check homework, simplify fractions and radicals, or find a GCF or LCM by hand.
Updated
Results
- Exponent form (copyable)Uses ^ for powers
- Expanded formEvery prime factor written out
- Prime or composite
- Distinct prime factors
- Number of divisorsIncluding 1 and the number itself
- Sum of divisors σ(n)Including the number itself
- Perfect, abundant or deficientCompares the proper divisors' sum with the number
- All divisorsListed when there are 64 or fewer
| Number | Smallest prime factor | Quotient |
|---|
Results are estimates. See the methodology below.
How to use the calculator
- Enter a whole number from 2 up to 10¹⁵ (1,000,000,000,000,000).
- Read the factorization in three forms: with superscript exponents (2³ × 3² × 5), with caret exponents you can paste into other tools (2^3 × 3^2 × 5), and fully expanded (2 × 2 × 2 × 3 × 3 × 5).
- Check the extras: prime or composite, the number of distinct primes, how many divisors the number has, their sum, and whether it is perfect, abundant or deficient. The divisors themselves are listed when there are 64 or fewer.
- Follow the table for the factor tree: each row divides by the smallest prime factor until the quotient is 1.
How the calculator factors a number
The fundamental theorem of arithmetic says that every whole number greater than 1 can be written as a product of primes in exactly one way, apart from the order of the factors. The calculator finds that product in three stages: it divides by every prime below 1,000, tests what is left with a deterministic Miller–Rabin primality test, and splits any remaining composite part with Pollard's rho method (Brent's variant). Every result is exact.
From the factorization n = p₁^a₁ × p₂^a₂ × … the other results follow:
- Number of divisors: d(n) = (a₁ + 1)(a₂ + 1)…, because each prime can appear from 0 up to aᵢ times in a divisor.
- Sum of divisors: σ(n) = Π (pᵢ^(aᵢ+1) − 1) ÷ (pᵢ − 1), which includes n itself.
- Classification: compare the proper divisors (σ(n) − n) with n. Equal means perfect, greater means abundant, smaller means deficient.
Worked examples
1. Factor tree for 360
| Number | Smallest prime factor | Quotient |
|---|---|---|
| 360 | 2 | 180 |
| 180 | 2 | 90 |
| 90 | 2 | 45 |
| 45 | 3 | 15 |
| 15 | 3 | 5 |
| 5 | 5 | 1 |
So 360 = 2³ × 3² × 5. It has (3 + 1)(2 + 1)(1 + 1) = 24 divisors, which add up to 1,170. Its proper divisors total 810, more than 360, so 360 is abundant.
2. A perfect number: 28
28 = 2² × 7, with divisors 1, 2, 4, 7, 14 and 28. They sum to 56, exactly twice 28, so the proper divisors add back to 28 and the number is perfect. The calculator gives the same verdict for 496 = 2⁴ × 31 and 8,128 = 2⁶ × 127.
3. Large numbers
- 600,851,475,143 = 71 × 839 × 1,471 × 6,857, with 16 divisors.
- 999,966,000,289 = 999,983², the square of a prime, so it has only 3 divisors.
- 999,999,999,999,989 is prime.
Using the result
A factorization makes many school problems mechanical. To simplify a fraction, cancel the primes the numerator and denominator share. For a square root, pull out each pair of equal primes. For the greatest common factor and the least common multiple, compare the factorizations of the numbers, or let the GCF calculator and the LCM calculator do it for a whole list.
Frequently asked questions
Is 1 a prime number?
No. 1 is considered neither prime nor composite, which is why the calculator starts at 2. If 1 counted as a prime, factorizations would stop being unique, since 6 could be written as 2 × 3, 1 × 2 × 3, 1 × 1 × 2 × 3 and so on.
How do I make a factor tree?
Divide the number by its smallest prime factor, write down that prime, and repeat with the quotient until you reach 1. The primes you wrote down are the factorization. Starting with any factor pair (360 = 36 × 10) also works; the tree looks different but always ends with the same primes.
How do I find the GCF and LCM from prime factorizations?
Line up the factorizations. For the GCF, keep the shared primes with their lowest exponents; for the LCM, keep every prime with its highest exponent. With 84 = 2² × 3 × 7 and 126 = 2 × 3² × 7, the GCF is 2 × 3 × 7 = 42 and the LCM is 2² × 3² × 7 = 252.
How can I tell how many factors a number has?
Add 1 to each exponent in the prime factorization and multiply. 360 = 2³ × 3² × 5 gives 4 × 3 × 2 = 24 factors. A prime always has exactly 2, and the square of a prime has 3.
What is a perfect number?
A number whose proper divisors (all divisors except itself) add up to the number. The first four are 6, 28, 496 and 8,128. Every prime is deficient, while numbers such as 12 and 360 are abundant.
Why is the limit 10^15?
Up to 10¹⁵ the calculator can give an exact, proven answer straight away. Larger numbers are outside the range this page is built and tested for; factoring a big product of two large primes can take far longer.
Sources
This calculator is a learning aid. For graded work, show the method your teacher asks for.