Prime Numbers

Primes are the building blocks of integers. Every integer > 1 can be uniquely factored into primes.

First 25 Primes

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

Primality Tests

MethodComplexity
Trial DivisionO(√n)
Miller-RabinO(k log² n)
AKSPolynomial (theoretical)

How to Use This Prime Number Checker

Enter a number to check if it is prime. The calculator also shows the prime factorization and lists nearby primes.

Formula & How It Works

A prime number is divisible only by 1 and itself. Test: check divisibility by all primes up to √n. If none divide evenly, the number is prime.

Calculation Example

97 is prime (not divisible by 2, 3, 5, 7 β€” and √97 < 10). 91 = 7 Γ— 13 (not prime, even though it looks like it might be).

Expert Tips

All primes > 2 are odd, and all primes > 3 are of the form 6kΒ±1. Primes are infinite (proven by Euclid). Large primes are the foundation of RSA encryption used in internet security.

Frequently Asked Questions

What is a prime number?

A number greater than 1 that has no divisors other than 1 and itself. Examples: 2, 3, 5, 7, 11, 13...

Is 1 prime?

No. By convention, 1 is neither prime nor composite.

How many primes are there?

Infinitely many. Euclid proved this around 300 BC. The largest known prime (2024) has over 41 million digits.