Prime Checker

Is a number prime?

About This Calculator

A prime number is divisible only by 1 and itself. Primes are the building blocks of all integers and fundamental to cryptography, hash functions, and number theory.

Formula

Trial division: test all integers 2 to sqrt(n)
If none divide evenly, n is prime
1 is not prime; 2 is the only even prime

Example Calculation

Is 97 prime?

  1. sqrt(97) ≈ 9.85 — test divisors 2, 3, 5, 7
  2. 97 / 2 = 48.5, 97 / 3 = 32.3, 97 / 5 = 19.4, 97 / 7 = 13.9
  3. None divide evenly
97 is prime

First 20 Prime Numbers

PositionPrimePositionPrime
1st211th31
2nd312th37
3rd513th41
4th714th43
5th1115th47
6th1316th53
7th1717th59
8th1918th61
9th2319th67
10th2920th71

Frequently Asked Questions

Why is 1 not a prime number?
By convention, 1 is excluded from the primes because including it would break the Fundamental Theorem of Arithmetic, which states every integer has a unique prime factorization.
How do I quickly test if a large number is prime?
Only test divisibility by primes up to the square root of n. If no prime up to sqrt(n) divides n evenly, it is prime.
Are there infinitely many prime numbers?
Yes. Euclid proved this around 300 BC: assume a finite list of primes, multiply them all and add 1 — the result is either prime itself or divisible by a prime not in the list.