Prime factorization calculator
Enter a whole number to write it as a product of primes, such as 360 = 2³ × 3² × 5. You also get a factor tree, how many divisors the number has, their sum and the list of every divisor.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Type a whole number from 2 up to 9,007,199,254,740,991.
- Read the prime factorization in exponent form, and the list of every prime factor.
- Follow the factor tree to see how the number splits, and use the divisor count, sum and list for further work.
How it works
The number is divided by 2, by 3, and then by candidates of the form 6k − 1 and 6k + 1 up to its square root, which covers every prime. Each factor is divided out as many times as it fits. Whatever is left above 1 at the end is itself a prime. Divisors are built by multiplying the prime powers together, so no number is tested one by one.
Worked example
360 = 2³ × 3² × 5. The tree: 360 = 2 × 180, 180 = 2 × 90, 90 = 2 × 45, 45 = 3 × 15, 15 = 3 × 5. It has (3 + 1)(2 + 1)(1 + 1) = 24 divisors: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 120, 180, 360, and they add up to 1,170.
Tips
- Use the factorizations of two numbers to find their GCD and LCM: take the lowest and the highest exponent of each prime.
- A number is a perfect square exactly when every exponent is even.
- The divisor count is odd only for perfect squares.
Frequently asked questions
What is prime factorization?
Writing a number as a product of primes. Every whole number above 1 has exactly one such product, apart from the order of the factors. 360 = 2 × 2 × 2 × 3 × 3 × 5, or 2³ × 3² × 5 in exponent form.
How do I read the factor tree?
Each row splits a number into its smallest prime factor and the rest. The bold prime is a finished leaf, and the other number is split again in the next row until only primes remain. 60 splits as 2 × 30, then 30 as 2 × 15, then 15 as 3 × 5.
How are the number of divisors and their sum found?
If the number is p^a × q^b × …, the number of divisors is (a + 1)(b + 1)…, and their sum is the product of (p^(a+1) − 1) ÷ (p − 1) over the primes. For 360 that is 4 × 3 × 2 = 24 divisors and 15 × 13 × 6 = 1,170.
How large a number can it factor?
Up to 9,007,199,254,740,991, the limit of exact whole numbers in a browser. It divides by candidates up to the square root, so a prime or a product of two large primes near that size can take a fraction of a second.
Is 1 a prime?
No. A prime has exactly two divisors, 1 and itself, and 1 has only one. That is also why 1 has no prime factorization.