Prime Numbers and the Riemann Hypothesis by Mazur and Stein makes use of an interesting function: $$\hat{\Phi}_{\le C}(\theta)=2\sum_{prime\:powers\:p^n\le C}p^{-n/2}\cdot log(p)\cdot cos(n\cdot log(p)\cdot \theta)$$

The function is basically a Fourier transform of symmetrized Dirac $\delta$ functions at the prime powers. Per the authors, the "spikes" of $\hat{\Phi}_{\le C}(\theta)$ "for large $C$ pinpoints the spectrum" $\{\theta_1,\theta_2,\theta_3,... \}$, i.e., the sequence in order of imaginary parts of the non-trivial $\zeta$-function zeros.

As an example, here's what I get with a C program and MATLAB to replicate Figure 32.7 in the book: enter image description here

That matches the figure very well so I'm pretty sure the code is right. The red lines are at the locations of the the first six $\theta$'s

The first few $\theta_i$ are more or less at the negative peaks. However, increasing $C$ further doesn't really improve the situation:

enter image description hereenter image description here enter image description here

Shouldn't the $\theta_i$ corresponding to the imaginary parts of the non-trivial $\zeta$-function zeros get more distinct as $C$ increases, not less? Or maybe there's a bug?


Per reuns suggestion of regularizing each term in the sum by $p^{−a^2θ^2n/2}$, here's a comparison of the result at $\theta_1$ using $a=0$ vs. $a=0.1$:

$a=0$: enter image description here

$a=0.1$: enter image description here

  • 1
    $\begingroup$ The series $f(\theta) = 2\sum_{prime\:powers\:p^n}p^{-n/2}\cdot log(p)\cdot cos(n\cdot log(p)\cdot \theta)$ converges only in the sense of distributions, you need to look at the regularized version $f_a(\theta)= 2\sum_{prime\:powers\:p^n\le C}p^{-n/2}\cdot log(p)\cdot cos(n\cdot log(p)\cdot \theta) p^{- a^2 \theta^2 n/2}$ with $a$ small to make appear the convolution of the gaussian $|a|^{-1} e^{- \theta^2/(2a^2)}$ with the distribution $\sum_{t \text{ imaginary part of non trivial zeros}} \delta(\theta-t)$ en.wikipedia.org/wiki/Explicit_formulae_(L-function) $\endgroup$
    – reuns
    Feb 22, 2019 at 0:37
  • $\begingroup$ That regularization term is interesting--I'll try to grok what it's doing, but as a magic trick at the moment, given the right choice of $a$ it does seem to make the $\theta_i$ stand out (see edit above). Does $a$ need to be tuned empirically for each $\theta_i$? $\endgroup$
    – Joe Knapp
    Feb 22, 2019 at 11:15

1 Answer 1


I made this code

    N = 10^5; mu = zeros(1,N); mu(1)= 1; for n = 1:N,  mu(n+n:n:end) = mu(n+n:n:end)-mu(n); end; 
    Lambda = zeros(1,N); logn = log(1:N); for n = 1:N, Lambda(n:n:end) =  Lambda(n:n:end) + log(n)*mu(1:floor(N/n)); end; 

    Lambda12 = Lambda ./ (1:N).^(1/2);         % Lambda(p^k) = log(p)

    % the raw Fourier transform of the OP
    dx = 0.01; X = [0:dx:50]; f = zeros(1,length(X)); 
    for l = 1:length(X), x = X(l); f(l) = sum(Lambda12 .* exp(-i*logn * x));end; 

    % substract the contribution of the pole at s=1/2 and the trivial zeros at s = -2k-1/2
    h = (exp(log(N)*(1/2-i*X))-1)./(1/2-i*X); for k = 1:500, h = h - (exp(log(N)*(-2*k-1/2-i*X))- 1)./(-2*k-1/2-i*X); end; g = f-h; 

    % remove oscillations due to finite N
    G = [g(end:-1:1),g]; K = 50; filter = ones(1,K)/K; filter = conv(filter,filter); filter = conv(filter,filter); F = conv(real(G),2*filter); F = F-F(5000); 


You can run it in https://octave-online.net/ (click 2 times on add 15 seconds during the execution)

The peaks are the non-trivial zeros of $\zeta(s)$, each one integrates to $2\pi$

enter image description here

  • $\begingroup$ Neat--the code runs nicely on MATLAB. I gather you first get the Mobius function, then Mangoldt, and then the graph above is of $$f(\theta)=\sum_{c=1}^C \frac{\Lambda(c)-1}{\sqrt c}\cdot r(c)\cdot cos(\theta \log c)$$ Where $r$ is the regularization term. Is that it? Is this closely related to the $\Phi$ function above somehow? $\endgroup$
    – Joe Knapp
    Feb 22, 2019 at 20:23
  • $\begingroup$ One thing I noticed: the regularization term in your program doesn't do much. If it's set to 1 the output is pretty much the same. But if 1 isn't subtracted from $\Lambda$ the result looks pretty much like the $\Phi$ function above. So maybe that's really the key (removing the effect of the pole at 1 like the comment states)? $\endgroup$
    – Joe Knapp
    Feb 23, 2019 at 1:43
  • $\begingroup$ @JoeKnapp I cleaned up the code, can't do much better. $\endgroup$
    – reuns
    Feb 23, 2019 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.