Explicit formula for Riemann zeros counting function 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.
 A: It looks like the exact formula being sought here can be found in A.P. Guinand, "A summation formula in the theory of prime numbers", Proceedings of the London Mathematical Society (2) 50 (1948) 107--119.  The first page is visible here without subscription:
http://plms.oxfordjournals.org/content/s2-50/1/107.extract

        

You can see the explicit formula in the abstract, although hard to see the fine detail without access to the full PDF.  This is a general form involving a function $f$ and an integral transform thereof.  The abstract mentions "appropriate conditions" on $f$: I can't see what these are, but with an appropriate choice of this function, the formula displayed would presumably reduce to a fairly straightforward relation between a sum over the primes and a sum over the nontrivial zeros.
A: 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*)

A: Assuming the Riemann Hypothesis, you can use a smooth approximation to the characteristic function of an interval in the Guinand-Weil explicit formula to approximately count the number of zeros of the zeta-function in an interval on the critical line. This expresses the approximate number of such zeros in terms of an integral of your test function and a sum over primes, as you seek. In fact, this can be set-up in such a way that the sum over primes is finite. (This method can be used to give upper and lower bounds for the number of zeros, but not an exact formula.) 
The details are (essentially) contained in a paper by Goldston & Gonek "A note on S(t) and the zeros of the Riemann zeta function" available on Dan Goldston's webpage: math.sjsu.edu/~goldston/publications.htm 
A: The formula is given by Guinand as said in his answer by Matthew Watkins but it can be found in page 111 of the paper and reads: assuming Riemann Hypothesis and $T>0$
$$\frac12(N(T+0)+N(T-0))=\frac{T}{2\pi}\log\frac{T}{2\pi}-\frac{T}{2\pi}-$$
$$-
\frac{1}{\pi}\lim_{N\to\infty}\Bigl[\sum_{n=1}^N\Lambda(n)\frac{\sin(T\log n)}{n^{1/2}
\log n}-\int_1^N \frac{\sin(T\log t)}{t^{1/2}\log t}dt-$$
$$-\frac{\sin(T\log N)}{\log N}\Bigl(\sum_{n=1}^N\Lambda(n)n^{-1/2}-2N^{1/2}
\Bigr)\Bigr]+$$
$$+\frac{1}{2\pi}\left(\operatorname{\rm am}\Gamma\left(\frac12+iT\right)-T\log T+T\right)+$$
$$+\frac{1}{\pi}\arctan(2T)-\frac{1}{4\pi}\arctan(\sinh(\pi T)),$$
where $\operatorname{\rm am} \Gamma(\frac12+it)$ is defined by making 
$\operatorname{\rm am} \Gamma(\frac12)=0$ and continuing analytically along
any path not meeting the real axis.
Of course the sums where  $\Lambda(n)$ appears can be considered sum about 
primes.
A: Guinand's paper is accessible at archive.org (p.111)
A: This may not help you, but: With Excel I calculated the Discrete Fourier Transform of a function = unit spikes at locations of the logarithms of a few hundred primes. The zeta zeros (imaginary part) show up as spikes. But it only works for small numbers of primes and zeros. For a better approximation, I reversed the explicit formula in Riemann's, making the spike heights = ln(p)/sqrt(p), and included powers of primes at 1/exponent as much, like the Von Mangoldt function. That gave much cleaner results, valid for thousands of primes and zeros. However it does diverge (increasing oscillations) for really big values, because logs of primes get close (more than the zeta zeros in Reimann's formula). I'm leaving out some details. If you or anyone is interested, email me at robertjwalcott@yahoo.com for the spreadsheets or graphs.
