+Calculator+

Prime Number Calculator

Check if a number is prime, show its prime factorization, all divisors, and the next/previous prime.

Check a number

Up to 1 trillion is supported.

Is 997 prime?

Yes, prime

Neighbors

Previous prime: 991. Next prime: 1009.

All divisors (2)

1, 997

Frequently Asked Questions about the Prime Number Calculator

What is a prime number?
A prime is a whole number greater than 1 with no positive divisors other than 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. Every other integer above 1 is composite.
Is 1 a prime number?
No. By modern convention, 1 is neither prime nor composite. Excluding it keeps the fundamental theorem of arithmetic clean: every integer above 1 has a unique prime factorization.
How does the calculator check primality?
It uses trial division with a 6k plus or minus 1 optimization, testing divisors up to the square root of n. This is fast for numbers up to about a trillion.
What is prime factorization?
Writing a composite number as a product of primes. 60 = 2 x 2 x 3 x 5. Every integer greater than 1 has a unique prime factorization (up to ordering), the basis for cryptography like RSA.
Are there infinitely many primes?
Yes. Euclid proved this around 300 BCE with a short argument by contradiction. Despite their infinitude, primes thin out as numbers grow: near n, the density is roughly 1 / ln(n).