TITLE: Explicit formula for Riemann zeros counting function
QUESTION [31 upvotes]: I've often seen it stated (in vague terms) that there's a Fourier duality between the set of prime numbers and the set of nontrivial Riemann zeta zeros.
Because there are various explicit formulae whereby prime counting functions can be expressed as infinite sums of sinusoidal functions over the set of zeta zeros, I had always assumed that the same thing would work in the opposite direction.  That is, I imagined there was a well-known formula whereby the nontrivial-zeta-zeros-counting function could be expressed as an infinite sum of sinusoidal functions over the set of primes.
However, I've been unable to find such a formula.  The only explicit formula I've found for this counting function looks like this:
$$f(E) = \frac{1}{\pi} \Im(\ln(\Gamma(1/4 + iE/2)) - \frac{E}{2\pi}\ln(\pi) +  \frac{1}{\pi} \Im(\ln(\zeta(1/2 + iE)) + 1$$
where there's no explicit involvement of the primes.
Is anyone aware of a formula of the type I'm seeking?  I'm quite sure such a thing must exist, since a programmer friend recently looked at this and got curious enough to "illegally" substitute the (truncated) Euler product expression for zeta in the above (it doesn't converge in the critical strip, hence such a substitution is not mathematically valid), just to see what the resulting function would look like.  His plots of
$$N_m(E) = \frac{1}{\pi} \Im(\ln(\Gamma(1/4 + iE/2)) - \frac{E}{2\pi}\ln(\pi) - \frac{1}{\pi} \sum_{p < m} \Im(\ln(1-p^{-1/2-iE})) + 1$$ 
in three colours (corresponding to $m = 100$, $1000$ and $10000$, and where $E$ varies from $4$ to $60$) can be seen here:

The positions of the zeta zeros are clearly visible, so even though this isn't a valid formula, I imagine that there must be something like this which is valid.

REPLY [2 votes]: The Riemann zeta zeros counting function as a sum of the von Mangoldt function (or expanded with the Möbius function):

Mathematica program that exports 120 gif images to your Documents folder.
(*Integral*)(*start*)
Clear[k, n, s, i, d, r, q, f, a, b, integral, c, nn, n, k];
nn = 120;
delta = 1/10;
k = 16;
q = 10;
c = 1;
rr = 60;
f[s_, d_] = 
  N[-I*MoebiusMu[
     d]*(If[d == 1, 0, -((d^(1 - s) 1^-s)/(Log[d] + Log[1]))] + 
      Sum[-((d^(1 - s) n^-s)/(Log[d] + Log[n])), {n, 2, k}] + 
      ExpIntegralEi[-(-1 + s) Log[d] - (-1 + s) Log[
          k]] + (d^(1 - s) k^-s)/(2 (Log[d] + Log[k])) + 
      Sum[Sum[-(BernoulliB[2*(n + 1)]/((2*(n + 1))!))*(Abs[
           StirlingS1[2*n + 1, i]]) d k^(-2*n - 1) Gamma[1 + i, 
          s Log[k*d]] Log[k*d]^(-1 - i), {i, 0, 2*n + 1}], {n, 0, 
        q - 1}])];
integral[a_, b_, d_] = f[b, d] - f[a, d];
Print["Counting to ", nn];
rrr = N[Table[RiemannSiegelTheta[t]/Pi, {t, 0, rr, delta}]];
Monitor[iii = 
   Table[Table[
     Re[Sum[integral[1/2 + I*0, 1/2 + I*t, d]/n^c, {d, Divisors[n]}]]/
      Pi, {t, 0, rr, delta}], {n, 1, nn}];, n]
Monitor[Table[
  Export[StringJoin["image", ToString[i], ".gif"], 
   Show[Plot[(RiemannSiegelTheta[t] + Im[Log[Zeta[1/2 + I*t]]])/Pi + 
      1, {t, 0, 60}, PlotStyle -> {Red, Thickness[0.004]}, 
     ImageSize -> Large], 
    ListLinePlot[rrr - Sum[iii[[j]], {j, 1, i}], 
     PlotStyle -> Thickness[0.004], DataRange -> {0, rr}, 
     ImageSize -> Large], 
    Graphics[
     Text[Style["Counting Riemann zeta zeros using", Large], {21, 
       12}]], Graphics[
     Text[Style[
       StringJoin[ToString[i], 
        " terms of the von Mangoldt function."], Large], {23, 
       10}]]]], {i, 1, nn}], i]
(*end*)