Prime Factorization & Prime Test Calculator
Last updated: 2026-06-25
Prime factorization writes a number as a product of primes by dividing it from the smallest prime 2 upward. Example: 360 = 2³ × 3² × 5. A prime is a natural number greater than 1 whose only divisors are 1 and itself.
Enter an integer of 2 or greater below to get the prime factorization, primality and divisor count at once.
Prime factorization / prime test
Prime factorization
—
| Item | Value |
|---|---|
| Number entered | |
| Prime? | |
| Prime factorization | |
| Distinct prime factors | |
| Number of divisors |
Because it tests divisors up to √n, large primes can be somewhat slow. Use the result for reference.
How to use
- Enter an integer — Enter an integer of 2 or greater to factor.
- Calculate — Press Calculate to factor the number and test whether it is prime.
- View the result — The prime factorization (with exponent notation), primality, distinct prime factors and divisor count are shown in a table.
How prime factorization and primality testing work
Prime factorization expresses a composite number uniquely as a product of primes (the fundamental theorem of arithmetic). Start with the smallest prime 2, divide as long as it divides evenly, then move to the next prime. A primality test by trial division — checking divisibility from 2 up to √n — is the most intuitive approach.
| Concept | Description | Example |
|---|---|---|
| Prime | Only divisors are 1 and itself | 2, 3, 5, 7, 11, 13 |
| Composite | Has divisors besides 1 and itself | 4, 6, 8, 9, 10 |
| Prime factorization | Product of primes | 360 = 2³ × 3² × 5 |
| Divisor count | Product of (exponent+1) | (3+1)(2+1)(1+1)=24 |
| Primality test | Test divisors up to √n | 97 is prime |
1 is neither prime nor composite, and 2 is the only even prime. Prime factorization is also useful for finding the greatest common divisor and least common multiple. To compute the common divisors and multiples of several numbers at once, use the GCD & LCM calculator; to reduce fractions, use the fraction calculator.
Frequently Asked Questions (FAQ)
How does prime factorization work?
Divide the number by the smallest prime 2 repeatedly, then move on to the next prime when it no longer divides. For example, 360 = 2 × 2 × 2 × 3 × 3 × 5 = 2³ × 3² × 5.
What is a prime number?
A prime is a natural number greater than 1 whose only divisors are 1 and itself. 2, 3, 5, 7, 11, 13 … are primes, and 2 is the only even prime. 1 is not prime.
How do I count the divisors of a number?
If the prime factorization is p₁^a × p₂^b × …, the number of divisors is (a+1)(b+1)…. For example, 360 = 2³ × 3² × 5¹ has (3+1)(2+1)(1+1) = 24 divisors.
Can it handle very large numbers?
This calculator uses trial division up to √n, so very large numbers (especially large primes) can be slow. Stay within JavaScript's safe integer range (about 9 quadrillion).
Related calculators & guides
Last updated: 2026-06-25