Prime Number Checker — All Modes
Select a tool, enter your number(s), and get instant results with complete step-by-step working
Is N prime?
Prime factors
Primes in range
Find the Nth one
Pairs differ by 2
Next & prev prime
Eratosthenes
Grey = composite
Result Summary
More Useful Results
Visual Breakdown
Step-by-Step Working
What Are Prime Numbers?
Core concepts, history, and why primes are the fundamental building blocks of all mathematics
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… The number 2 is the only even prime — every other even number is divisible by 2 and therefore composite.
The Fundamental Theorem of Arithmetic states that every integer greater than 1 can be expressed as a unique product of prime numbers (up to the order of factors). This makes primes the irreducible "atoms" from which all whole numbers are built. For example, 360 = 2³ × 3² × 5 — there is no other way to write 360 as a product of primes.
Cryptography
RSA encryption — which secures every HTTPS website — relies on the fact that multiplying two large primes is easy, but factoring the result back is computationally infeasible.
Twin Primes
Twin primes are pairs of primes that differ by 2, like (3,5), (11,13), (17,19). Whether there are infinitely many twin primes is one of mathematics' greatest unsolved problems.
Sieve of Eratosthenes
A 2,000-year-old algorithm: write all numbers, strike out multiples of 2, then multiples of 3, 5, 7… What remains are all the primes. Still one of the most efficient methods for small ranges.
Largest Known Prime
As of 2024, the largest known prime is 2¹³⁶²⁷⁹⁸⁴¹ − 1, a Mersenne prime with over 41 million digits, discovered by the GIMPS project in October 2024.
Primality Test Methods — Reference
How to check if a number is prime, from basic trial division to advanced tests
| Method | How It Works | Best For | Complexity |
|---|---|---|---|
| Trial Division | Check divisibility by all primes up to √N | N < 10⁶ | O(√N) |
| Sieve of Eratosthenes | Strike out all multiples; remainders are prime | Find all primes up to N | O(N log log N) |
| Miller-Rabin | Probabilistic test using modular exponentiation | Very large numbers | O(k log²N) |
| AKS Primality Test | Deterministic polynomial-time algorithm | Theoretical / academic | O(log⁶N) |
| Fermat Test | If N is prime: aᴺ⁻¹ ≡ 1 (mod N) | Quick pre-check | O(log N) |
Frequently Asked Questions
Common questions about prime numbers and primality testing