Prime Number Generator
Generate prime numbers within specified ranges using efficient algorithms for mathematical analysis and cryptographic applications. Perfect for number theory research, encryption key generation, and educational mathematics.
Complete Guide: Prime Number Generator
Everything you need to know about using this tool effectively
The Prime Number Generator finds and lists prime numbers. It can generate all primes within a range, find the nth prime number, or test whether a specific number is prime. The tool uses the Sieve of Eratosthenes for efficient range generation and Miller-Rabin primality testing for large numbers. All processing happens in the browser.
This tool implements the Sieve of Eratosthenes to find all primes up to a limit, and trial division or Miller-Rabin testing for individual number checks. It reports the prime numbers, their count, and the sum within the range.
Teaching prime numbers
Generate lists of primes for math lessons and exercises.
Cryptography research
Find large primes for cryptographic key generation.
Checking if a number is prime
Verify primality of a number for mathematical proofs or homework.
Exploring number theory
Study the distribution of primes within ranges.
Choose a mode
Select range generation, nth prime, or primality test.
Enter your parameters
Type the range, position, or number to test.
Generate
Click Generate to compute the results.
Copy or download
Copy the primes or download them as a file.
A prime number is only divisible by 1 and itself.
2 is the only even prime number.
The Sieve of Eratosthenes is the most efficient way to find all primes up to a limit.
There are infinitely many primes, proven by Euclid around 300 BCE.
What is a prime number?
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Examples: 2, 3, 5, 7, 11, 13.
How does the tool find primes?
It uses the Sieve of Eratosthenes for efficient range generation and Miller-Rabin probabilistic testing for individual primality checks. The sieve is fastest for generating all primes up to a limit while Miller-Rabin handles very large numbers.
Is my data sent to a server?
No. All computation happens in your browser. Nothing is transmitted.
How large a range can I search?
The tool handles ranges up to millions depending on your device's memory. Larger ranges require more RAM and may take a few seconds to compute.
What is the largest known prime?
The largest known prime is a Mersenne prime with over 41 million digits, discovered through the Great Internet Mersenne Prime Search (GIMPS). Mersenne primes take the form 2^p - 1 where p is also prime.