Prime Number Calculator
A prime number is an integer greater than 1 that is divisible only by 1 and by itself: 2, 3, 5, 7, 11, and so on. Every number that is not prime (that is, every composite number) can be written as a product of primes in exactly one way; this is the fundamental theorem of arithmetic.
This calculator decides whether the number you enter is prime using an exact division test, and for composite numbers it gives the prime factorization in exponent notation. It also lists all the positive divisors (the first 24 of them), counts the divisors, and finds the first prime that comes after the number. It works with numbers up to 1 trillion.
Formula
Primality test: n is prime if no prime from 2 up to √n divides it Fundamental theorem of arithmetic: n = p₁ᵃ × p₂ᵇ × ... (uniquely) Number of divisors = (a + 1) × (b + 1) × ... (each exponent plus one, multiplied)
To decide whether n is prime you do not have to try every number up to n; trying up to √n is enough, because the partner of any divisor larger than √n is necessarily smaller than √n. Another easily forgotten point is that 1 does not count as prime.
How to Calculate
- Enter an integer between 2 and 1 trillion.
- See in the results whether the number is prime or composite.
- For composite numbers, examine the prime factorization and the list of divisors.
- Read off the number of divisors and the first prime that follows the number.
Worked Examples
Is 97 prime?
97 is prime: none of the primes below its square root (two, three, five, seven) divides it. It has exactly 2 divisors, 1 and 97. The first prime after it is 101.
Is it prime?: Yes — 97 is a prime number · Prime factorization: 97 (prime itself) · Number of divisors: 2
The factors of 360
360 is composite and splits into 2³ × 3² × 5. The number of divisors is the product of the exponents each increased by one: (3+1) × (2+1) × (1+1) = 24 divisors. The next prime number is 367.
Is it prime?: No — 360 is a composite number · Prime factorization: 2³ × 3² × 5 · Number of divisors: 24
Does 1001 factor?
At first glance 1,001 looks prime, but it is really the product 7 × 11 × 13; it has 8 divisors: 1, 7, 11, 13, 77, 91, 143, and 1,001. The next prime is 1,009.
Is it prime?: No — 1,001 is a composite number · Prime factorization: 7 × 11 × 13 · Number of divisors: 8