Skip to main content
8 of 9
edited body

Finding the next prime number is faster within the same range after about $10^8$. Eratosthenes is as fast as $O(n)=n\log(\log(n))$, while the best known algorithm for Riemann zeros is far from trivial and about $O(n)=n^{1+\varepsilon}$ where if you want to reduce $\varepsilon$ you need more space.

The difference between the two is that you can find a very large Riemann zero without knowing any previous zero, while you need to find quite some number of first few primes before any given value, if you want to be 100% sure that you have found a prime number. For example, in the most primitive implementation of Eratosthenes sieve, if you have primes up to $n$ you can find primes up to $n^2$, but you still need to list primes up to $n$.

Although it looks reasonable to store many prime number or many zeta zeros on some huge disks in some public database and simply extract the ones you want, this has its own limitation of simply keeping this storage alive and accessible for a prolonged time (more disks involved, higher the probability that one will die sooner or later, and then you would have to recalculate anyway), so these libraries are limited and we still calculate both prime numbers and Riemann zeta zeros for any larger values on request, although, typically, we would not recalculate it all each time again and again. The current state of affair is therefore somewhere in between, we store a reasonably large amount especially if they help the algorithm itself and we calculate the rest.

You can, however, use some algorithms that are testing if a number is prime, but then you have to scan some region in order to find a prime number. The best known deterministic is way faster than any known Riemann zeta algorithm, it is known as AKS algorithm and has $O(\log(n)^6)$. Above that you are left with quick, but only probabilistic algorithms, for prime numbers.

Overall prime is a winner. For Riemann zeta you do have a quick estimation that are trivial to calculate alike if all zeros are in the form of $\frac{1}{2} \pm i\gamma_n$, meaning Reimann hypothesis is correct then

$$\gamma_n \approx 2 \pi \frac{n-\frac{11}{8}}{W\left(\frac{n-\frac{11}{8}}{e}\right)}$$

where $W$ is Lambert $W$ function.