2
$\begingroup$

I mean at a fairly large height. At what height does the difficulty, change sign?

Let us give the number of the prime numbers, with 5 decimals accurate. (When we use the zeros of zeta function formula) The question is general. Since zeros are directly linked to the number of prime numbers, we eventually gain in time, to finding roots or staying in the classic way of finding prime numbers? My English is bad, if you do not understand I will try better.

$\endgroup$
6
  • 2
    $\begingroup$ I don't think this comparison is meaningful, because the prime number is an integer and the zeta-zero is a real, so it will all depend on how many decimal places you want to know. $\endgroup$ Commented Apr 29, 2019 at 17:04
  • 1
    $\begingroup$ @Carlo, is the question meaningful if we just ask for the integer part of (the imaginary part of) the next zeta zero? $\endgroup$ Commented Apr 30, 2019 at 6:59
  • $\begingroup$ Let us give the number of the prime numbers, with 5 decimals accurate. (When we use the zeros of zeta function formula) The question is general. Since zeros are directly linked to the number of prime numbers, we eventually gain in time, to finding roots or staying in the classic way of finding prime numbers? My English is bad, if you do not understand I will try better. $\endgroup$ Commented Apr 30, 2019 at 9:23
  • 3
    $\begingroup$ According to Hans Riesel and Gunnar Göhl, Some calculations related to Riemann's prime number formula, Mathematics of Computation Vol. 24, No. 112 (Oct., 1970), pp. 969-983, the first 29 zeros of zeta will get you $\pi(x)$ up to about $x=1000$. $\endgroup$ Commented Apr 30, 2019 at 13:27
  • $\begingroup$ To be more understandable. To calculate π (1000000) = 78498 with 5 decimal places, I needed 150000000 zeros. more time and more computational power. When this method begins to outweigh, the Eratosthenes sieve. We also have to take into account the time of calculating the roots. This is my general question. We also have a similarity in the multiplication of large integers with the classical methods and the method, FFT. In small integers, the classical method outperforms, but in fairly large integers, the advantage changes over the FFT method. When? $\endgroup$ Commented May 2, 2019 at 11:39

3 Answers 3

4
$\begingroup$

Alex Peter's answer basically answers your question, but perhaps in a somewhat confusing way. The short answer is that it's always easier to find the next prime than the next zeta zero.

Lists of small primes and lists of zeros with small imaginary part (with some degree of accuracy) have been precomputed and stored. For example, the LMFDB contains the first hundred billion zeta zeros. So technically, the time it takes to "compute" a value in this range is the time it takes to retrieve the value from the precomputed database. I suppose one could try to figure out whether it's faster to look up a prime or faster to look up a zero, but this is sort of silly, and I don't think it's the comparison you're interested in.

An integer that is around $N$ can be tested for primality in time polylogarithmic in $N$, but to find a prime, you'll usually have to test around $\log N$ integers before succeeding. The best way to compute zeta zeros uses the Odlyzko–Schönhage algorithm (see also Chapter 4 of Odlyzko's unpublished manuscript on computing the $10^{20}$th zero). We can debate what it means to "compute" a zero, but however you slice it, computing $\zeta(1/2 + it)$ where $t\approx N$ is certainly going to take at least $cN^{1/2}$ operations for some constant $c$. This is so much worse than polylog($N$) that there's really no meaningful sense in which computing zeros is ever easier than computing primes.


I believe that this answers your question as stated. However, I see that you also refer to the "number of prime numbers." This suggests to me that your intended question may have been about the prime-counting function. That is, if we want to compute $\pi(x)$, the number of primes less than $x$, is there a faster method than simply generating all the primes less than $x$? The answer is yes; for large $x$, some variant of the Meissel–Lehmer algorithm is better. So you could ask, how big does $x$ have to be for this method to be better? The answer is that $x$ does not have to be all that large. Even in the 19th century, Meissel computed $\pi(10^8)= 5761455$ by hand, surely with much less effort than computing the first $5761455$ primes explicitly. (To be sure, you have to worry about the possibility of bugs in your code! Notoriously, several published lists of values of $\pi(x)$—including those by Meissel and Lehmer!—have had incorrect values.) Note, however, that these methods do not involve computing zeros of the zeta function.

$\endgroup$
1
$\begingroup$

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 numbers 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. Knowing that a typical gap between primes less than $n$ is $\log(n)$ this all gives a fairly good way of extracting even very big primes.

Whichever way you go, calculate individual prime or a sequence of primes, prime is a winner. For Riemann zeta you do have a quick and good 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.

$\endgroup$
5
  • 4
    $\begingroup$ "The difference is that you can find a very large Riemann zeros without knowing any previous zero, while you need to find all primes before any given value if you want to be 100% sure that you have found a prime number." This is not accurate. For example the AKS algorithm is completely deterministic and does not require knowing all the prior primes. This is not the only example. Many other procedures will give you a certificate of primality which can be easily checked without having all the prior primes. $\endgroup$
    – JoshuaZ
    Commented Jan 21, 2023 at 16:40
  • $\begingroup$ @JoshuaZ I compared Eratosthenes and calculating Riemann zeta zeros first. Then I am mentioning other algorithms for testing primes. The problem is that the question is asking about the next prime number, suggesting that you want to have all of them or at least some of them in some region first before deciding about the next. This is why testing prime number is simply different thing. $\endgroup$
    – Alex Peter
    Commented Jan 21, 2023 at 17:00
  • $\begingroup$ You still don't need all the prior primes to check what the next prime is. You'll have some interval where you can check each one's primality without checking all the primes before that value. $\endgroup$
    – JoshuaZ
    Commented Jan 21, 2023 at 17:26
  • $\begingroup$ @JoshuaZ Some, but essentially you do need quite some number of previous primes. You can say that you need first $n$ primes to decide up to $n^2$ primes, sure, but the essence is that you do need some number of first primes anyway. $\endgroup$
    – Alex Peter
    Commented Jan 21, 2023 at 21:12
  • $\begingroup$ To find primes up to $n^2$ by Eratosthenes you need the primes up to $n$, not the first $n$ primes. $\endgroup$ Commented Jan 21, 2023 at 23:08
0
$\begingroup$

What is easier to find the function or it's Fourier transform? If your function is spread out then it's easier to find the Fourier transform. If your function is concentrated it's easier to find the function.

The same situation holds for primes because they are sort of Fourier dual objects to zero. If you would like to exactly count the number of primes up to $x$ (i.e the function is spread out) then it's easier to find the zeros (i.e the Fourier transform). If you would like to determine whether a specific integer is prime (i.e the function is concentrated) then it's easier to not look at the zeros (i.e the Fourier transform).

These have solid algorithmic justifications. If you want to determine the number of primes up to $x$ it can be accomplished using zeros in time about $O(x^{1/2 + \epsilon})$. If you want to check whether an integer of size $x$ is prime it's much easier to use a direct algorithm rather than compute the many zeros that are required to check if it's prime.

On the other hand note one thing: once you have pre-computed many zeros in advance you can very quickly check if many integers in specific ranges are primes. This is similar to the situation with the Fast Fourier Transform.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .