How it’s calculated
Every whole number greater than 1 is either prime or can be written in exactly one way as a product of primes. The calculator finds this by trial division: it divides by 2, 3, 5, 7, … and records how many times each prime goes in. If no prime up to the square root of the number divides it, the number is prime.
The number of divisors comes from the exponents: if n = p₁^a × p₂^b × …, then n has (a + 1)(b + 1)… divisors, since each divisor picks any power of each prime from 0 up to its exponent.
Example: 360 = 2³ × 3² × 5. The number of divisors is (3 + 1)(2 + 1)(1 + 1) = 24, and they are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 120, 180, 360.
Frequently asked questions
Is 1 a prime number?
No. A prime has exactly two divisors (1 and itself), and 1 has only one. That is also why factorization starts at 2.
Is 2 a prime number?
Yes, and it is the only even prime, because every other even number is divisible by 2.
What is prime factorization used for?
It is a quick way to find the greatest common factor and least common multiple, to simplify fractions and square roots, and it underlies many ideas in number theory.
Why is there a limit of 10¹²?
Trial division only needs to test primes up to the square root, about a million steps for 10¹², which runs instantly in your browser. Larger numbers need more advanced methods.
Embed this calculator
Add this free calculator to your own website. Copy the code below into your page’s HTML:
Need this calculator branded, changed or built around your own prices?See custom business solutions →
Sources
- Prealgebra 2e, §2.5 Prime Factorization and the Least Common Multiple — OpenStax
- Prealgebra 2e, §2.4 Find Multiples and Factors — OpenStax
Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.
Added · Last updated · How we check our calculators
Spotted a mistake or missing option? Report a problem· Suggest a calculator