So I was playing around in MATLAB and I plotted the following function;
$$f(n) = \frac{p_n}{n}, $$ where $p_n$ denotes the $n^{th}$ prime number (i.e. 5 is the $4^{th}$ prime number). The following plot emerged. The result looks a lot like a natural log. Indeed, plotting $e^{f(n)}$ as a function of $n$ reveals a straight(ish) line. From where does this regularity arise? Can this result be extrapolated to find other primes?
$\endgroup$ 31 Answer
$\begingroup$You are correct, the function is indeed in first approximation a natural log. The result you stumbled upon is the prime counting function $\pi(n)$, that counts how many primes there are smaller than $n$, for which one finds: $$ \pi(n) \approx \frac{n}{\log n} $$ and this is the same equivalent to saying that the $n$th prime would be expected to be close to $n \log n$. Unfortunately this result can not be used to predict primes, but is important in number theory.
$\endgroup$