I'm trying to understand Gauss' theorem: $$ \frac{\pi(x) }{x/\ln x} \to 1 $$ for large $x$.
I've taken the list of first 1000 prime numbers from Utah university site, saved them to file
2
3
5
7
...
and plotted these values against their corresponding line numbers:
x | y
--+--
2 | 1
3 | 2
5 | 3
7 | 4
...
If I understand correctly $y(x)$ is the same as the prime-counting function $\pi(x)$, except that $y(x)$ is not defined for composite or non-integer $x$.
I used gnuplot to draw the graph:
gnuplot> plot '1000primes.txt' using 1:($0+1)
In 1:($0+1) the first 1 stands for the first column in file for the x-points and $0+1 means line number+1 as the y-points (counting of line numbers starts from 0). This way the first data point was at (2,1).
From the theorem I'd expect this graph to merge with $x/\ln(x)$ for large $x$, but it wouldn't - it would pass above $x/\ln(x)$, though resembling it in shape. So I thought to multiply by a constant:
gnuplot> f(x) = a*x/log(x)
Using gnuplot's fit command I found the best-matching value for a=1.13926:
gnuplot> fit f(x) '1000primes.txt' using 1:($0+1) via a
So that the asymptotic relation is $$ \pi(x) \to 1.13926... \times \frac{x}{\ln(x)} $$
The resulting graph:
gnuplot> plot '1000primes.txt' using 1:($0+1), x/log(x), f(x)

What am I understanding/doing wrong?
I think the case here is that the convergence is very slow, and it may have misled you... for instance, see: this image
Just for the record, there are functions that converge more quickly (one example being the one in the lower part of the above image).