One of 1,229 primes between 2 and 9,999. Indivisible by nature, selected with equal probability.
A prime number has exactly two factors: one and itself. This deceptively simple definition produces one of the deepest structures in mathematics. Every integer greater than one can be expressed as a unique product of primes, a result so fundamental it is called the Fundamental Theorem of Arithmetic. The number 60 is 2 × 2 × 3 × 5. The number 83 is simply 83. One decomposes. The other stands alone. Primes are the atoms from which every other number is built.
Around 300 BCE, Euclid proved that prime numbers never end. His proof remains one of the most elegant in all of mathematics: assume finitely many primes exist, multiply them all together, add one, and the result is divisible by none of them. Therefore another prime must exist. This contradiction proves the supply is infinite. Twenty-three centuries later, the argument is taught in every number theory course worldwide, as fresh as the day it was conceived.
Between 2 and 9,999, exactly 1,229 primes exist. Between 2 and one million, there are 78,498. The density thins as numbers grow, yet primes never stop appearing. The Prime Number Theorem, conjectured by Carl Friedrich Gauss at age fifteen and proven independently by Jacques Hadamard and Charles-Jean de la Vallée Poussin in 1896, states that the number of primes below N approaches N / ln(N). Near one billion, roughly one in every 21 numbers is prime.
For ranges up to one million, the tool builds a complete prime sieve in your browser using the Sieve of Eratosthenes, invented around 240 BCE. The algorithm systematically eliminates composite numbers: cross out multiples of 2, then multiples of 3, then 5, and so on. What remains is every prime in the range. The tool then selects one at random using crypto.getRandomValues(), the same cryptographic entropy source that secures online banking. Every prime in the range has exactly equal probability of selection.
For ranges above one million, the tool generates random candidates and tests each for primality using trial division up to the square root. This is the method shown in the divisibility animation above: if no integer from 2 through √N divides evenly, the number is prime. At one billion, the square root is about 31,623, so each test takes microseconds. The result is the same: a verified prime, selected fairly, computed entirely on your device.
Twin primes are pairs separated by exactly two: (3, 5), (11, 13), (29, 31), (41, 43). Whether infinitely many twin pairs exist remains one of the great unsolved problems in mathematics. In 2013, Yitang Zhang made a breakthrough by proving that infinitely many prime pairs exist with a gap of at most 70 million. Subsequent collaborative work through the Polymath project reduced that bound to 246. The gap from 246 to 2 remains open.
The neighbor display below each result shows this gap structure in real time. Generate a few primes and notice how the gaps vary unpredictably. When a gap of 2 appears, the tool highlights it as a twin pair. The statistics panel tracks how many twins you discover. Every twin prime this tool generates is a tiny data point in a question that has resisted proof for over two thousand years.
Prime numbers serve as the gateway to number theory for students at every level. Have each student generate a prime from /prime/2/100 and verify it by hand: divide by 2, 3, 5, 7. If none divide evenly, the number is prime, because 7² = 49 exceeds the range. The divisibility animation above the result demonstrates exactly this process. For older students, try /prime/100/999 and explore why more factors need testing as numbers grow. The square root boundary is a concrete lesson in algorithmic efficiency.
Project /prime/1000/9999 and generate ten primes. Ask students to identify twin pairs and compute the gaps between consecutive primes. The distribution scatter in the statistics panel builds a visible map of where primes fall. Compare with the prime number theorem prediction: near N, prime density is approximately 1/ln(N). The tool requires no accounts, stores no data, and sets no cookies. Students use it and leave no trace.
Every prime generated on this page comes from your browser's own random number generator. The server delivers the page and the sieve algorithm. Your device runs the computation, selects the prime, and displays the result. The server never learns which prime you received. Your generation history lives in localStorage on your device, under your control alone.
The URL defines the range completely. Type any bounds directly into the address bar:
Send this link. They get the same range, a different prime. Compare your indivisible numbers.
Daily Inspiration
Jury-selected work from the A' Design Award, presented fresh each morning.