[Math] How are large prime numbers found

prime numbers

So I've found multiple ways of determining if a number is prime but I was wondering how they pick a number in the first place. For example the GIMPS project I assume is just trying different numbers to square 2 by but what about other methods? Or is it just a process of testing each and every unknown number?

Best Answer

GIMPS just considers Mersenne primes, so there is a fixed formula.

However if you are looking for a "biggish" prime, say 1024-bits well suited for cryptography, that is a prime $p$ with $2^{1024} < p < 2^{1025}$. Out of the $2^{1024}$ numbers in the range, approximately $$\frac{2^{1025}}{\log 2^{1025}} - \frac{2^{1024}}{\log 2^{1024}}$$ are prime. So the fraction which are prime is $$\frac{2}{\log 2^{1025}} - \frac{1}{\log 2^{1024}}= \frac{2}{1025\log 2} - \frac{1}{1024\log 2} = 0.001406$$ Since you can test as many as you want, that's not such bad odds.

Related Question