Prime number theorem
The prime number theorem (PNT) describes the approximate distribution of primes among the positive integers. As integers get larger, primes get rarer at a rate quantified by this theorem.
This leads to a few useful applications. First of all, if you wanted to get an idea of roughly how many primes exist among the first \(512\) positive integers, you'd just need to calculate \(\frac{512}{\ln(512)} \approx 82.\)
Furthermore, if you wanted to estimate the probability of selecting a prime out of the first \(512\) positive integers, you'd just need to calculate \(\frac{82}{512} \approx 0.16.\)
Generally, the probability of selecting a prime out of the first \(x\) positive integers can be estimated using the formula \(\frac{1}{\ln(x)}.\)
The prime number theorem is also useful for generating large primes because it gives you an estimate of how many times you'd need to randomly generate an integer in a specific range before you're likely to get one that passes a primality test. Without going into specifics, the number of random trials necessary depends on the number of digits of the prime you are trying to generate, rather than its magnitude, which is why this method of generating primes is efficient.
References
- PrimePi.svg: Bender2k14, CC BY-SA 3.0, via Wikimedia Commons.