Can Stirling's approximation be used to obtain lower and upper bound for $\pi(x)$?

552 Views Asked by At

The Willan's formula is given as follows (taken from Ribenboim's Little book of bigger primes): $$ \pi(x)=\sum_{j=2}^{x}f(j) \text{ where } f(j)=\frac{\sin^2\left(\pi\frac{(j-1)!^2}{j}\right)}{\sin^2\left(\frac{\pi}{j}\right)} $$ And the famous Stirling's formula: $$ n! \approx \sqrt{2 \pi n}\left(\frac{n}{e}\right)^n $$ We know that we can obtain both lower and upper bounds for $n!$ using this formula. So is it possible to apply the Striling's approximation to $(j-1)!$ in the Willan's formula - to obtain lower and upper bounds for $\pi(x)$?

1

There are 1 best solutions below

6
On BEST ANSWER

Stirling's formula unfortunately has potentially big errors - the approximation does not mean that $$n! -\sqrt{2 \pi n}\left(\frac{n}{e}\right)^n\to 0,$$ only that $$\frac{n!}{\sqrt{2 \pi n}\left(\frac{n}{e}\right)^n}\to 1.$$

So an approximation of $n!$ is not of much use.

Basically, the above formula is "trivial" once you know Wilson's theorem:

$$p\text{ is prime}\iff (p-1)!+1\equiv 0\pmod p$$ and that $$p\text{is not prime}\iff (p-1)!\equiv 0\pmod p$$

That would mean a primality test could be computed by testing $(n-1)!\bmod n$, but Sterling won't do, there, either, because the approximation is not "good enough" to ensure it is within $1$ of $(n-1)!$.

Specifically, $$n!=\sqrt{2 \pi n}\left(\frac{n}{e}\right)^n + O\left(\sqrt{2\pi (n-1) }\left(\frac{n-1}{e}\right)^{n-1}\right)$$

That's a big room for error - basically, a constant times $(n-1)!$. You'd need an approximation that was within $1/2$ for $n$ large enough (to distinguish $-1$ and $0$.)