Prime Number Calculator

MathLast updated: August 17, 2026

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.

Enter an integer between 2 and 1,000,000,000,000 (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

  1. Enter an integer between 2 and 1 trillion.
  2. See in the results whether the number is prime or composite.
  3. For composite numbers, examine the prime factorization and the list of divisors.
  4. 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

Frequently Asked Questions

What is a prime number, and why is 1 not prime?
A prime number is one with exactly two positive divisors, 1 and itself. The number 1 has only one divisor, so it does not count as prime. This is not a technicality but a necessity: if 1 were prime, the uniqueness of prime factorization would break down (6 = 2 × 3 = 1 × 2 × 3 = ...).
How do you tell whether a number is prime?
The number is divided in turn by the primes up to √n; if none of them divides it exactly, the number is prime. For 97, since √97 ≈ 9.8, only 2, 3, 5, and 7 have to be tried. This calculator uses an accelerated version of the same method and gives an exact answer up to 1 trillion.
What is the largest prime number?
There is no largest prime; Euclid proved roughly 2,300 years ago that the primes are infinite. The largest known primes are Mersenne primes with millions of digits, found through distributed computing projects.
How do you get the number of divisors from the factorization?
If n = p₁ᵃ × p₂ᵇ × ..., the number of divisors is (a+1) × (b+1) × ..., because every divisor is built by choosing, for each prime factor, a power between 0 and its exponent. For 360 = 2³ × 3² × 5, that gives 4 × 3 × 2 = 24 divisors.
Is there an even prime number?
The only even prime is 2; every other even number is divisible by 2 and is therefore composite. That makes 2 both the first prime and the only even one.
Where are prime numbers used in everyday life?
Modern encryption (RSA, for example) rests on the fact that factoring the product of two very large primes is computationally hard. Secure communication, from internet banking to messaging apps, depends on prime numbers.