TITLE: Tight prime bounds
QUESTION [16 upvotes]: This is a cross-post of this question on MSE. I would not usually do this, but have decided to in this case since it has had no responses having been posted as a bounty question. I did not delete the MSE question since so many users have starred it (and are apparently interested in seeing it answered) and not all of those users will have an MO account. If it receives a positive response here, I intend to link it to the MSE question for the benefit of those users. If however, this is objected to by MO users, or is not deemed 'research level', I shall respectfully remove it.
The question is: Is it likely that
$$\left|\operatorname{li}(n)-\sum_{k=1}^{\lfloor\log(n)\rfloor}\dfrac{\pi(n^{1/k})}{k}-\log(2)-\dfrac{1}{2}\right|<\dfrac{2\sqrt{n}}{e\log(n)}?$$
This is of course, almost identical to saying
$$|R(n)-\pi(n)|<\dfrac{2\sqrt{n}}{e\log(n)}$$ where $R$ is the Riemann prime counting function, but this is a little too tight since this doesn't hold for $n=113$. Since 
$$
\sum_{k=1}^{\lfloor\log(n)\rfloor}\dfrac{\pi(n^{1/k})}{k}\approx\operatorname{li}(n)-\sum_{k=1}^{\infty}2\ \Re\left(\operatorname{Ei}\left(\rho_k\log\left(n\right)\right)\right)-\log(2)
$$
and since $\pm\dfrac{2\sqrt{n}}{\Im(\rho_1)\log(n)}$ bounds $2\ \Re\left(\operatorname{Ei}\left(\rho_1\log\left(n\right)\right)\right)$  
does it follow that $\pm\dfrac{2\sqrt{n}}{C\log(n)}$ will bound $\sum_{k=1}^{\infty}2\ \Re\left(\operatorname{Ei}\left(\rho_k\log\left(n\right)\right)\right)$ for some $C$ (assuming RH)? 
$C=e$ seems particularly tight. Is this a realistic bound to propose?

REPLY [27 votes]: The inequality you propose would imply that
$$ |\operatorname{li}(n)-\pi(n)| \ll \frac{\sqrt{n}}{\log n}. $$
On the other hand, Littlewood (1914) showed that this relation is false, in fact he proved that the left hand side divided by the right hand side is $\Omega(\log\log\log n)$.
So the inequality you propose is false.
Added 1. Littlewood's original paper is "Sur la distribution des nombres premiers", C. R. Acad. Sci. Paris, 158 (1914), 1869-1872. For a modern proof, see Theorem 15.11 in Montgomery-Vaughan's book "Multiplicative number theory I." (which is apparently the last result in the book).
Added 2. The OP asked in a comment how the inequality above follows from his proposed bound. Here are the details. We clearly have (for $n>100$)
$$ \operatorname{li}(n)-\pi(n) = S_1+\frac{\pi(n^{1/2})}{2} + S_2,$$
where
$$S_1:=\operatorname{li}(n)-\sum_{k=1}^{\lfloor\log(n)\rfloor}\dfrac{\pi(n^{1/k})}{k}-\log(2)-\dfrac{1}{2}$$
$$S_2:=\sum_{k=3}^{\lfloor\log(n)\rfloor}\dfrac{\pi(n^{1/k})}{k}+\log(2)+\dfrac{1}{2}.$$
The second expression $S_2$ is a sum of less than $\log n$ terms, each less than $n^{1/3}$. Hence, by the triangle inequality,
$ |S_2|\leq n^{1/3}\log n \ll \sqrt{n}/\log n$.
Using also the OP's conjecture $S_1\ll \sqrt{n}/\log n$ we get, again by the triangle inequality,
$$ |\operatorname{li}(n)-\pi(n)|\leq |S_1|+|\pi(n^{1/2})|+|S_2|\ll \frac{\sqrt{n}}{\log n}.$$
This, on the other hand, contradicts Littlewood's result from 1914.