We believe math and science education should be free and accessible to everyone. Why education matters >

Prime Number Calculator

Check whether any number is prime, see its complete prime factorization, get a list of all divisors, and find the nearest primes above and below it.

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first few primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29.

How to Test for Primality:

To check if a number n is prime, you only need to test divisors up to sqrt(n). If none of them divide n evenly, the number is prime. This works because if n = a x b, at least one of a or b must be less than or equal to sqrt(n).

Composite Numbers:

A composite number has more than two divisors. Every composite number can be written as a unique product of primes (the Fundamental Theorem of Arithmetic). For example, 60 = 2^2 x 3 x 5.

Special Facts About Primes:

  • 2 is the only even prime number
  • 1 is neither prime nor composite
  • There are infinitely many primes (proven by Euclid around 300 BC)
  • The largest known primes are Mersenne primes, found using distributed computing
  • Prime numbers are the foundation of modern cryptography (RSA encryption)

Did this solve your problem?

Frequently Asked Questions

Search Calculators

Search across all calculator categories