3
$\begingroup$

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$
  • 4
    $\begingroup$ By the Prime Number Theorem we have $\pi(n)\sim\frac{n}{\log n}$ and $p_n\sim n\log n$, so, nothing unexpected. $\endgroup$ – Jack D'Aurizio Jul 3 '17 at 22:18
  • $\begingroup$ Congrats on noticing! Let $p_n =M$. The prime number theorem says the number of primes equal or less than $M$ is roughly $\frac M{\ln M}$. But we know this exactly $n$ by definition so $n \approx \frac {p_n}{\ln p_n}$ and $\ln p_n \approx \frac {p_n}{n}$ which is exactly your result. $\endgroup$ – fleablood Jul 3 '17 at 23:05
  • $\begingroup$ " Can this result be extrapolated to find other primes?" Unfortunately not. It can tells us approximately how many primes we can find in an interval but it can not tell us anything about which of those numbers are prime. $\endgroup$ – fleablood Jul 3 '17 at 23:16
3
$\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$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.