Let: $\rho$ be a non-trivial zero of the Riemann zeta function, $\Lambda$ be the von-Mangoldt function and $\psi(x) =\sum\_{n \leq x} \Lambda(n)$. What is the best known upper bound for


$$f(x, T) := \psi(x) - x + \sum\_{|\rho| \leq T} \frac{x^{\rho}}{\rho}$$


for $\frac{T}{\log T} \leq x \leq T$, with or without the RH ? Note that the explicit formula gives $f(x, T) \ll \frac{x(\log T)^2}{T}$, so I'm essentially asking if there is anything sharper than this.



On the error term of the Riemann explicit formula
Without any restriction on $x$ and $T$ (aside from $x,T \ge 2$) one has
$$f(x,T) \ll \frac{x}{T}\log^2 x + \log x,$$
which goes back to Landau. A modern reference is Theorem 12.5 in Montgomery and Vaughan's book (p. 400). By using the Brun-Titchmarsh inequality when bounding the error incurred from Perron one can do better. This is done by Goldston in "On a result of Littlewood concerning prime numbers. II" ([Acta Arith. 43, 49-51 (1983)](https://www.doi.org/10.4064/aa-43-1-49-51)) where the main Theorem states
$$\begin{equation}
\label{eq:G}\tag{\*} f(x,T) \ll \frac{x}{T}\log x\log \log x + \log x
\end{equation}$$
unconditionally. Another reference is Exercise 2 in p. 408 of the aforementioned book. In your range this means $(\log T)^2$ in your bound can be replaced by $\log T\log \log T$.


Remarks:


1. Infinitely often $|f(x,T)| \gg \log x$ because of the discontinuities of $f$ at prime powers. So when $x \asymp T/\log T$ your bound is already sharp.
2. For smaller $T$ (which is not the case that interests you) one can do better. Recently it was shown that
$$\begin{equation}
\label{eq:CHJ}\tag{\*\*} 
f(x,T) \ll \frac{x}{T}\log x + \sqrt{x}
\end{equation}$$
holds when $T= O(\sqrt{x}\log x\log\log x)$ ($\eqref{eq:CHJ}$ holds for larger $T$ as well but then it is weaker than $\eqref{eq:G}$). See Theorem 1.2 (and its proof!) of Cully-Hugill and Johnston's paper "On the error term in the explicit formula of Riemann-von Mangoldt" ([Int. J. Number Theory 19, No. 6, 1205-1228 (2023)](https://doi.org/10.1142/S1793042123500598)). The main ingredient is a new Perron formula (their Theorem 2.1), building on a previous one by Ramaré. For *very* small $T$ (which one should never choose) one can bound both $\psi(x)-x$ and $\sum\_{|\rho|\le T}x^{\rho}/\rho$ using the Vinogradov-Korobov zero-free region, which gives $f(x,T) \ll x\exp(-c(\log x)^{3/5}(\log \log x)^{-1/5})$ for $T \ll \exp(c'(\log x)^{3/5}(\log \log x)^{-1/5})$.
3. For smaller $T$ one can *conditionally* shave one more $\log x$: Theorem 1 of Goldston's paper "On a result of Littlewood concerning prime numbers'' ([Acta Arith. 40, 264-271 (1982)](https://www.doi.org/10.4064/aa-40-3-263-271)) gives, on RH,
$$\begin{equation}\label{eq:RH}\tag{\*\*\*}
f(x,T) \ll \frac{x}{T}+\sqrt{x} \log T
\end{equation}$$
when $T = O(\sqrt{x})$ (it holds for larger $T$ too but will be weaker than either $\eqref{eq:G}$ or $\eqref{eq:CHJ}$). Goldston then applies $\eqref{eq:RH}$ with $T =\sqrt{x}/\log x$ to obtain a slick proof of Cramér's result on gaps between primes. If $T=O(\sqrt{x}/\log^2 x)$, the 'trivial' RH bound $f(x,T) \ll \sqrt{x}\log^2 x$ beats $\eqref{eq:RH}$.


Estimates $\eqref{eq:CHJ}$ and $\eqref{eq:RH}$ are proved with explicit constants. Estimate $\eqref{eq:G}$ can be made explicit too -- see GH from MO's answer.


One should say that $\eqref{eq:CHJ}$ and $\eqref{eq:RH}$ supersede a conditional result of [Littlewood](https://doi.org/10.1017/S0305004100014158), who proved on RH that $f(x,T) \ll\tfrac{x}{T}\log x+ \sqrt{x}\log x$. In fact, $\eqref{eq:CHJ}$ shows Littlewood's result holds unconditionally.


