TITLE: Legendre's Constant
QUESTION [7 upvotes]: In a couple of web pages, I see that Legendre's constant is defined to be $\lim_{n \to \infty} (\pi(n) - (n/\log(n)))$ (for example, here and here).
Actually the first uses $\lim_{n \to \infty} (\log(n) - (n/\pi(n)))$, but I have the same question in either case.
To be honest, I just assumed that this was a typo for $\lim_{n \to \infty} (\pi(n) / (n/\log(n)))$ (that is, the prime number theorem). However, in both pages it looks to me as if the claim really is that $\lim_{n \to \infty} (\pi(n) - (n/\log(n)))$ exists and is $1$. Really?
I don't know whether to be more surprised that the limit exists or that its value is 1
Does anyone else find it surprising?

REPLY [10 votes]: 1. The prime number theorem in the form
$$\pi(n)=\mathrm{li}(n)+O(ne^{-c\sqrt{\log n}})$$
combined with the approximation
$$\mathrm{li}(n)=\frac{n}{\log n}+\frac{n}{\log^2 n}+O\left(\frac{n}{\log^3 n}\right)$$
shows that
$$\pi(n)-\frac{n}{\log n}=\frac{n}{\log^2 n}+O\left(\frac{n}{\log^3 n}\right).$$
So the left hand side tends to infinity quite rapidly, it has no finite limit. 
2. The correct definition of Legendre's constant is
$$A:=\lim_{n\to\infty}\left(\log n-\frac{n}{\pi(n)}\right),$$
and the third display above shows that it equals $1$:
\begin{align*}\log n-\frac{n}{\pi(n)}
&=\log n-\frac{n}{\frac{n}{\log n}+\frac{n+o(n)}{\log^2 n}}\\
&=\log n-\frac{\log n}{1+\frac{1+o(1)}{\log n}}\\
&=(\log n)\left(1-\frac{1}{1+\frac{1+o(1)}{\log n}}\right)\\
&=(\log n)\left(1-1+\frac{1+o(1)}{\log n}\right)\\
&=(\log n)\frac{1+o(1)}{\log n}\\
&=1+o(1).\end{align*}