Prime Number Checker
Check whether a number is prime, see its prime factorization and find the next prime number.
What is a prime number?
A prime number is a whole number greater than 1 whose only divisors are 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. A number greater than 1 that is not prime is called composite. The number 1 is neither prime nor composite.
How the checker works
To test a number n, it is enough to try dividing by primes up to √n: if n had a factor larger than √n, it would also need a matching factor smaller than √n. The calculator divides by 2 and then by every odd number up to the square root, recording each factor it finds.
Is 391 prime? √391 ≈ 19.8, so test divisors up to 19. 391 ÷ 17 = 23 exactly, so 391 = 17 × 23 and is not prime. The next prime after 391 is 397, the 78th prime; the one before it is 389.
What else the checker tells you
- Divisors: the number of divisors follows from the factorization. For 360 = 2³ × 3² × 5 it is (3 + 1) × (2 + 1) × (1 + 1) = 24, and all 24 are listed.
- Perfect, abundant or deficient: a perfect number equals the sum of its other divisors: 28 = 1 + 2 + 4 + 7 + 14. The first four are 6, 28, 496 and 8,128. If the sum is larger the number is abundant (360's divisors add up to 810), and if smaller it is deficient, as every prime is.
- Special primes: twin primes differ by 2 (101 and 103); a Sophie Germain prime p has 2p + 1 also prime (2, 3, 5, 11, 23…); a Mersenne prime has the form 2ⁿ − 1 (3, 7, 31, 127); an emirp is a prime that gives a different prime when reversed (13 and 31).
- Semiprimes, squares and cubes for composite numbers, such as 391 (a semiprime) or 64 (both 8² and 4³).
- Position: for numbers up to 10 million, which prime it is (2 is the 1st, 127 the 31st) or how many primes lie below it.
Prime numbers from 1 to 100
There are 25 primes below 100: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97. Choose "List the primes in a range" to list them for any range of up to a million numbers; the calculator uses a segmented sieve of Eratosthenes, which crosses out the multiples of each prime instead of testing every number separately.
| Up to | Number of primes | Share of all numbers |
|---|---|---|
| 100 | 25 | 25% |
| 1,000 | 168 | 16.8% |
| 10,000 | 1,229 | 12.3% |
| 100,000 | 9,592 | 9.6% |
| 1,000,000 | 78,498 | 7.8% |
Primes thin out slowly: by the prime number theorem, the share of primes near a number n is about 1 ÷ ln(n). Around one trillion that is roughly 1 in 28, and the calculator finds 36,400 primes in the last million numbers below 1,000,000,000,000.
The fundamental theorem of arithmetic
Every whole number above 1 can be written as a product of primes in exactly one way, ignoring order. For example 360 = 2³ × 3² × 5. This prime factorization is the basis for finding GCF and LCM and for simplifying fractions.
Why primes matter
Large primes underpin modern encryption. RSA keys use the product of two primes hundreds of digits long; multiplying them is easy, but factoring the product back into its primes would take ordinary computers far longer than the age of the universe.
Quick divisibility rules
- Divisible by 2 if the last digit is even; by 5 if it ends in 0 or 5.
- Divisible by 3 if the sum of digits is divisible by 3; by 9 if the sum is divisible by 9.
- Divisible by 11 if the alternating sum of digits is divisible by 11.
Frequently asked questions
Is 1 a prime number?
No. A prime must have exactly two distinct divisors, and 1 has only one. Excluding 1 keeps prime factorizations unique.
Is 2 the only even prime?
Yes. Every other even number is divisible by 2, so it has at least three divisors.
How many prime numbers are there?
Infinitely many, as Euclid proved around 300 BC. There are 25 primes below 100 and 168 below 1,000.
Last reviewed November 2026.