Why aren’t my prime pictures pretty?

This is a followup to my post What if primes hated to start with nine? and you might want to read that post for context. This post describes my failure to create a nice illustration of the effect of the zero of \zeta at 1/2 + 14.134725 i on the distribution of the primes. Of course, the answer might be really dumb — I might just have a coding error, or the range of primes I was using (around 10^9) may not be large enough. But I suspect there is something interesting here, and I’d like to know what. The basic question of this post is “Why does the left hand graph look as random as the right hand one?”

UPDATE I have a prettier picture!

Let \pi(a,b) be the number of primes between a and b. Let \mathrm{Err}(a,b) = \pi(a,b) - \int_a^b \frac{dt}{\log t}, the error in the PNT estimate. Let \mathrm{NormErr}(a,b) = \mathrm{Err}(a,b) / \sqrt{\pi(a,b)}. The idea of \mathrm{NormErr} is to give a reasonably normalized version of the error, which will be comparable for intervals (a,b) in very different domains. The red data series below is the values of \mathrm{NormErr}( k \times 10^5, (k+1) \times 10^5) — in other words, checking whether five digit primes prefer certain starting digits over others. The green and blue series are the same thing for seven digit and nine digit primes. Notice that, even though we are comparing intervals of very different sizes, \mathrm{NormErr} is staying nicely contained between -0.5 and 0.5. So I think I found a reasonable normalization.

Note also that there is no sign that primes hate to start with nine.

Let \rho = 14.134725; the imaginary part of the first \zeta zero. As I understand it, the fact that \zeta(1/2+ i \rho) is 0 should mean that the fractional part of (\rho \log p)/(2 \pi) should NOT be evenly distributed. In other words, the number of primes in the interval (e^{2 \pi k/\rho}, e^{2 \pi (k+0.1)/\rho}) should behave differently from the number of points in (e^{2 \pi (k+0.5)/\rho}, e^{2 \pi (k+0.6)/\rho}).

I decided to test this by computing \mathrm{NormErr}(10^9 e^{2 \pi (k+j 0.1)}, 10^9 e^{2 \pi (k+(j+1) 0.1)}) as j ranged from 0 to 9 for several smallish values of k. We have e^{2 \pi 0.1/\rho} \approx 1.045 so the intervals in question have width \approx 4.5 \times 10^7; I figured that should be wide enough bins that the zeta zeroes would dominate any short term effects. Here are the results for 0 \leq k \leq 5; the colors are assigned in rainbow order starting with red.

In case you are trying to convince yourself that there really is a valid pattern in this data, here is the analogous computation with \rho replaced by 17, which is nowhere near a \zeta zero. There are two interesting things to note: First, the data is different, so I am working in a range large enough to see the difference between e^{2 \pi 0.1/\rho} and e^{2 \pi 0.1/17}. But, second, the data looks equally random.

What am I missing?

Starting to see a signal

As I discuss further in a comment below, I realized that part of the problem is that the contributions of the different zeta zeroes are too close to each other to separate out in this way. If you look at the waveform of a chime, you’ll see that it looks vaguely sinusoidal, because the dominant overtone is so much stronger than the others. If you try the same thing for a big clattery noise, you won’t see anything, even if the spectrum is discrete so that, in theory, there is a dominant overtone. The primes are more like the latter case.

This analogy suggested the numerical experiment I should do — to take an average over many frequency cycles. My picture shows (in blue) the total of \mathrm{NormErr}(10^3 e^{2 \pi (k+j 0.1)}, 10^3 e^{2 \pi (k+(j+1) 0.1)/\rho}) as k runs from 0 to 40 — a range which means that I am looking at primes between 1000 and 5.3 \times 10^{10}. In other words, I am keeping track of whether the “first digit” of p, in base e^{2 \pi/\rho} \approx 1.56, prefers one value over another. The red points are running through 40 cycles with \rho replaced by 17. Since \rho < 17, I go through fewer primes when tracking this higher frequency signal — this chart goes form 1000 up to 2.6 \times 10^9.

Recall that \mathrm{ErrNorm} tends to have magnitude about 1. Notice that the blue signal is of size \approx (1/2) 40, like the sum of 40 roughly correlated steps while the red signal is of size \approx \sqrt{40}, like the sum of a random walk of length 40.

This picture is perhaps a little too nice. I decided to redo the computation changing nothing but the ranges of primes being used. In the following picture, I am going from e^{2 \pi 15/\rho} \approx 800 to e^{2 \pi 60/\rho} \approx 2.9 \times 10^{11}.

(Note that this will shift which point on the x-axis is called zero. In the later picture, points at the ends of the interval contribute positively to \cos (\rho \log p), points in the middle contribute negatively.) I again see that the blue signal is larger than the red signal, but I can no longer pretend that the blue signal looks particularly smooth; indeed, the red signal looks smoother. Still, there is definitely something there, even if I can’t get enough primes to see it very clearly.

6 thoughts on “Why aren’t my prime pictures pretty?

  1. In case this is a stupid coding error, and someone feels like reading my Mathematica, the image was produced with:

    pi[a_, b_] := PrimePi[b] - PrimePi[a]

    piErr[a_, b_] := pi[a, b] - NIntegrate[1/Log[t], {t, a, b}]

    ErrNorm[a_, b_] := piErr[a, b]/Sqrt[pi[a, b]]

    rho = 14.134725

    bar[k_] :=
    Table[ErrNorm[10^9 *E^(2 Pi (k + j 0.1)/rho),
    10^9 * E^(2 Pi (k + (j + 1) 0.1)/rho)], {j, 0, 9}]

    ListPlot[Table[bar[k], {k, 0, 5}],
    PlotStyle -> {{Red, PointSize[0.015]}, Orange, Yellow, Green, Blue, Purple}]

    The command is called bar because an earlier version of it was called foo.

  2. The von Mangoldt explicit formula connecting zeroes and primes reads as follows:

    \sum_{n < x} \Lambda(n) = x - \sum_\rho \frac{x^\rho}{\rho} + \ldots

    where the \ldots are negligible errors in practice. Thus, the effect of a zero \rho with real part 1/2 on the number of primes up to x is basically of size O(x^{1/2}), which is about the same size as that of random noise (in fact, it is even a little bit smaller). So the effect of these zeroes are quite hard to see. Their effect can be felt eventually, but it takes an enormous amount of time before it becomes visible: see for instance the article on Skewes’ number.

    To get a pretty picture in a reasonable amount of time, you would need a zero with real part larger than 1/2, but unfortunately (or fortunately) I don’t have one of these to offer you…

  3. Thanks! That’s both informative and sad. So, on the one hand, the normalized PNT error has a nice Fourier series with discrete frequencies but, on the other hand, the contribution of any individual term in that series is overwhelmed by the remainder. It doesn’t seem to be a problem for writing papers, but it makes producing nice illustrations for blogposts difficult.

  4. So, another question. Most of us have seen pictures like slide 24 of this talk where we take sums over the first bunch of Riemmann zeroes (the first 100 zeroes in this case) and see a good approximation to \Lambda (or \pi, or \psi) emerging. I had assumed that there was some sort of symmetry in truncating Fourier transforms — if the first hundred \zeta zeroes gave a good approximation to \Lambda, then the first billion \lambda values would give a good approximation to \zeta. Is there anything more to say here than “nope, you were wrong”?

  5. Oh, I think I see. Imagine a big jangly noise, like a one year old pulling all the pans out of the cupboard and dumping them on the floor. One could take a Fourier transform of that sound and get some signal.

    Now, one could time-truncate the sound, like only listening for a second, and take the resulting Fourier transform, and the result would be pretty close. That’s like computing \zeta using only the first billion primes.

    And one could frequency truncate the signal and listen to the resulting sound, like listening to the clatter over a cheap cell phone. The result will be a pretty good approximation from the sound.

    But what one can’t do is look at a printout out of the amplitude of the soundwave and hope to see the dominant overtone, which is what I was trying to do, because the neighboring overtones are too similar in frequency and amplitude. One can only do that when the sound is closer to a pure tone — like ringing a bell — and that’s not what the primes sound like.

    Reasonable analogy?

Comments are closed.