# Bounds for prime counting function

The prime counting function $$\pi(x)$$ is defined as $$\begin{equation} \pi(x)=\sum_{p\leq x}1 \end{equation}$$ where $$p$$ runs over primes.
I have seen many bounds for $$\pi(x)$$ such as $$\begin{equation} \frac{x}{\log x}\left(1+\frac{1}{2\log x}\right)<\pi(x)<\frac{x}{\log x}\left(1+\frac{3}{2\log x}\right) \end{equation}$$ $$\begin{equation} \frac{x}{\log x - 1/2}<\pi(x)<\frac{x}{\log x + 3/2} \end{equation}$$ $$\begin{equation} \frac{x}{\log x+2}<\pi(x)<\frac{x}{\log x - 4} \end{equation}$$ Till now, what are the best known upper and lower bounds for the prime-counting function? Is there a better bound that $$\mathrm{Li}(x)$$?

• Some better bounds are here Oct 10 '20 at 10:10
• ${\rm Li}(x)$ is neither an upper bound nor a lower bound for $\pi(x)$, so it's not clear to me how you can call it a bound. Maybe what you want is $f(x)$ such that $|f(x)-\pi(x)|<|{\rm Li}(x)-\pi(x)|$ for all $x$, or for all sufficiently large $x$? Oct 10 '20 at 11:32
• $f(x)=\pi(x)$ is the best approximation to $\pi(x)$. A close relative is $f(x)=\pi(x)+1$. Oct 10 '20 at 15:03
• mathguy, do you know the prime number theorem with its error term? That will show that functions of the form $\mathop{\rm Li}(x) \pm C x\exp(-c\sqrt{\log x})$ are upper and lower bounds for $\pi(x)$, and explicit values for the constants $C$ and $c$ can be found. This is nearly the best known bound (the power of $\log x$ inside the exponential has been improved). Certainly no bounds of the form $\mathop{\rm Li}(x) \pm Cx^{1-\delta}$ are known. Oct 10 '20 at 19:51
• @mathguy: In my response below, I added some explicit bounds of the type Greg Martin mentioned. Check them out! Oct 10 '20 at 21:18

The following explicit version of the Prime Number Theorem was proved by Trudgian: $$|\pi(x)-\mathrm{li}(x)| In fact Trudgian's Theorem 2 is somewhat stronger than $$(\ast)$$, and with Mathematica it is straightforward to extend the validity of $$(\ast)$$ to $$x\geq 2$$.