Section 21.2 Some History
Definition 21.2.1.
We say that two functions
Essentially, in the long run these functions get as close to each other as you like, on a percentage basis.
Subsection 21.2.1 The first really accurate estimate and errors
In fact, Gauss makes this estimate even more precise. Here is the general idea. First, reinterpret the proportion as suggesting thatDefinition 21.2.2.
We give the name logarithmic integralβ3β to the (convergent) integral

xxxxxxxxxx
def _(n=100):
show(plot(prime_pi,3,n,color='black', legend_label=r'$\pi(x)$') + plot(x/log(x),3,n,color='red', legend_label=r'$x/\log(x)$') + plot(Li,3,n, color='green', legend_label='$Li(x)$'))
xxxxxxxxxx
def _(n=[100,1000,1000000,1000000000]):
P = prime_pi(n)
pretty_print(html(r"$\pi(%s)=%s$"%(n,prime_pi(n))))
pretty_print(html(r"The error with $%s/\log(%s)$ is $\approx %s$"%(n,n,P-(n/log(n)).n())))
pretty_print(html(r"The error with $Li(%s)$ is $\approx %s$"%(n,(P-Li(n)).n())))

One of the brilliant aspects of the internet is how much easier it is to find source material of such things. Courtesy of the digitization center at the State and University Library of GΓΆttingen (the university where Gauss worked), you can see a scan of the actual letter in questionβ4β.
In Figure 21.2.4, Gauss is comparing his calculations of the number of primes with his formula, as well as those of his correspondent and Legendre. Whether or not you can read Gauss' (quite legible) German, you can still note how in the last set of numbers he is essentially doing data science on Legendre's formula, with
Subsection 21.2.2 Exploring
Can we try for some more analysis? Since we saw that 
xxxxxxxxxx
def _(n=1000):
P = plot(prime_pi,3,n, color='black',legend_label=r'$\pi(x)$')
P += plot(Li,3,n, color='green',legend_label='$Li(x)$')
show(P, xmin=max(n-1000,0), ymin=prime_pi(max(n-1000,0)))
Fact 21.2.6.
For any number
Historical remark 21.2.7. Skewes' Number.
As remarkable as this seems, Littlewood's student Stanley Skewes proved the following even more amazing fact:
The first time this happens is no higher than
In Skewes' original paper, this bound had a