TTKTheTextKit

Prime Number Checker

Type a whole number to see whether it is prime. If it is not, the tool shows its smallest factor, and for every number it gives the next and previous prime. Two more modes list all the primes between two numbers, with a count and the number of twin prime pairs, and find the n-th prime. Numbers of up to 200 digits are accepted for the check. Everything runs in your browser.

Result
Prime
Proven prime
Next prime
1,000,033
Previous prime
999,983
7 digits

A prime has exactly two divisors, 1 and itself, and 1 is not prime. The check uses the Miller-Rabin test with the first 13 primes as bases, which is proven exact for every number below about 3.3 x 10^24, and gives a probable prime beyond that. When a number is composite the tool looks for its smallest factor by trial division up to 10,000,000. The range, count and n-th prime features use a sieve of Eratosthenes and cover numbers up to 20,000,000. Numbers of up to 200 digits are accepted. Everything runs in your browser.

Related Tools

[5 suggestions]

About the Prime Number Checker

A prime number is a whole number above 1 whose only divisors are 1 and itself. The first primes are 2, 3, 5, 7, 11 and 13, and 2 is the only even one. For large numbers, trying every divisor is too slow, so the checker uses the Miller-Rabin test with the first 13 primes as bases. That set is proven to give the right answer for every number below about 3.3 x 10^24, and for larger numbers it reports a probable prime, which is almost certainly prime. When a number turns out to be composite, the tool tries small divisors up to 10,000,000 to find its smallest factor. The range, count and n-th prime modes use the sieve of Eratosthenes, which covers numbers up to 20,000,000. For example there are 25 primes up to 100, 168 up to 1,000 and 78,498 up to 1,000,000, the 1,000th prime is 7,919, and 1,000,003 is prime. Twin primes are pairs that differ by 2, such as 11 and 13, and there are 8 pairs below 100. Mersenne numbers such as 2^61 - 1 are prime, while 2^67 - 1 is not, a result famously found by hand in 1903.

Is 1 a prime number?▾

No. A prime needs exactly two divisors, and 1 has only one. This convention keeps the rule that every number has a unique prime factorization.

How do I check if a large number is prime?▾

Use a primality test such as Miller-Rabin, which is fast even for numbers with dozens of digits. This tool does that and tells you whether the result is proven or probable.

How many primes are there below 100?▾

There are 25: 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.

What are twin primes?▾

Pairs of primes that differ by 2, such as 3 and 5, 11 and 13, or 41 and 43. There are 8 such pairs below 100.

Is my data uploaded?▾

No. The calculation runs in your browser and nothing you enter is sent anywhere.