Given that the density of the primes in \([1,N]\) is on the order of \(\frac{1}{\ln N}\) we’ll note that:

\begin{equation} \text{Li}(N) = \int_{2}^N \frac{1}{\ln x}dx = \text{li}(N)-\text{li}(2) \end{equation}

where

\begin{equation} \text{li}(N) \sim \frac{N}{\ln N} \sum_{k=0}^\infty \frac{k!}{(\ln N)^k} \sim \frac{N}{\ln N} + \frac{2N}{(\ln N)^2} + … \end{equation}

and therefore we obtain the asymptotic relation:

\begin{equation} \text{li}(N) \sim \frac{N}{\ln N} + \mathcal{O}\big(\frac{N}{(\ln N)^2}\big) \end{equation}

which yields the error term:

\begin{equation} \lvert \pi(N) - \frac{N}{\ln N} \rvert = \mathcal{O}\big(\frac{N}{(\ln N)^2}\big) \end{equation}

where \(\pi(N)\) is the prime counting function.

Note: The reflections considered here are those which have probably occurred to Gauss, before the Prime Number Theorem was proven.