# A smooth approximation of the prime number function $p_n$?

Linear regression suggests that there are $a,b\in\mathbb R^+$ such that

$$\displaystyle a+bx\sim \frac{x\lfloor e^x\rfloor}{p_{n}-x\lfloor e^x\rfloor}\tag1,\; n=\lfloor e^x\rfloor$$

where $p_n$ is the $n$-th prime and $\sim$ denotes asymptotically equivalence. Can this can be proved?

0   0.00000
1   9.64894
2   6.65115
3   5.60872
4   6.69764
5   6.45644
6   6.98725
7   6.81400
8   7.09048
9   7.28458
10  7.46297
11  7.62874
12  7.86839
13  8.08110
14  8.32635
15  8.55811
16  8.80205
17  9.04825
18  9.29361
19  9.54235
20  9.79004
21  10.03895
22  10.28804
23  10.53697
24  10.78539
25  11.03331
26  11.28060
27  11.52714
28  11.77287
29  12.01775
30  12.26173
31  12.50480

It follows from the prime number theorem that $$\displaystyle \lim_{n\to\infty}\frac{p_n}{n\ln n}=1\tag2$$ Thus, for any function $f(n)$ asymptotically equivalent with $0$, it holds that $$\displaystyle \lim_{n\to\infty}\frac{p_n}{(1+f(n))\cdot n\ln n}=1\tag3$$ If there exist $a$ and $b$ as above, select $$\displaystyle f(n)=\frac{1}{a+b\cdot\ln n}\tag4$$ would give a rather accurate smooth approximation $$\displaystyle p_n\approx \Big(1+\frac{1}{a+b\cdot\ln n}\Big)\cdot n\ln n\tag5$$

Extending the computations and making linear regression, strongly suggest that $a$ and $b$ exists and that $a\approx 4.84615$, $b\approx 0.247308$ and obviously (1) implies (5).

• But my answer "conditionally" confutes (5). More to the point, if (1) holds then taking $x=\log n$ and letting $n\to\infty$ yields $$\lim_{n\to\infty} \frac{n}{p_n-n\log n}=b\in\mathbb{R^+},$$ but this is false - e.g. due to the inequality in my answer. Looking at larger and larger $x$, $b$ would have to be made smaller and smaller. In this regard, note that $p_n$ also satisfies $p_n/n<\log n + \log\log n$ for $n\ge6$, and $\log\log n$ grows rather slowly. – Vincenzo Oliva Aug 9 '16 at 12:54
• In other words, probably $b$ needs to be replaced by $\frac1{\log x}$ in (1). – Vincenzo Oliva Aug 9 '16 at 13:22
• @VincenzoOliva, honestly I believe that your manipulations are erroneous. – Lehs Aug 9 '16 at 16:01
• What error, for example? – Vincenzo Oliva Aug 9 '16 at 16:15
• @VincenzoOliva. Well, there is no equality in (5), but you manipulate the formula as it was. Before you manipulate, exchange $\approx$ to $\sim$ and recall that $\sim$ is defined with help of the $\lim$-operator. – Lehs Aug 9 '16 at 16:40

If $(5)$ is meant to be accurate enough to imply $$\lim_{n\to\infty}\log n\left(\frac{p_n}{n\log n}-1\right)=\frac1b,$$then your conjecture is false. This follows from the well known lower bound$$\frac{p_n}{n}>\log n+\log\log n-1.$$
• But I don't claim that your limes hold. I claim that the expression on the right side in (5) is asymptotically equivalent to $p_n$ and that it is a rather good approximation, sometimes greater than $p_n$ sometimes less. As far as I have tested it's as good as $\ln n+\ln\ln n-1$. – Lehs Aug 9 '16 at 15:55
• @Lehs: Even so, it can't be as good precisely because the limit in my answer is $\infty$. – Vincenzo Oliva Aug 9 '16 at 16:14
• If you have a computer, test it! The given values of $a$ and $b$ works fine. – Lehs Aug 9 '16 at 16:41
• @Lehs: For what $n$ have you tested it? – Vincenzo Oliva Aug 9 '16 at 16:49
• Up to $n=5761455$, so far. And the approximation is of the same accuracy as your known formula, but isn't a lower bound. – Lehs Aug 9 '16 at 16:54