Formula for the nth prime number. [closed]

I need to see how to make a certain development, and did not find any reference to do, the only quote I found, so is the following, I know (have shown)

$$\pi(m)=-1+\sum_{j=1}^{m} F(j)$$ with $$F(j)=\left[ \cos^2 \pi\frac{(j-1)!+1}{j}\right]$$ and also I have to $$\pi(m)=\sum_{j=1}^{m} H(j)$$ for all $m\ge2$, at where $$H(j)=\dfrac{\sin^2\pi\dfrac{((j-1)!)^2}{j}}{\sin^2\dfrac{\pi}{j}}$$

this second part also fails to prove if someone wants to put some demonstration would be very happy, but the focus is the same demonstration that the nth prime number is given by

$$p_n=1+\sum_{m=1}^{2^n} \left[\left(\frac{n}{\sum_{j=1}^{m} F(j)} \right )^{1/n} \right ]$$

• Can you ask a clearer question. "I need to see how to make a certain development..." is the closest to a question in the above, but it is unclear what you mean by it. Oct 27, 2015 at 13:31
• @ Thomas Andrews Perhaps because of the language, but what I mean is I need a reference / book / article or a demonstration, as it does not find any. Excuse me. Oct 27, 2015 at 13:34
• @marcelolpjunior Is the question, Are the indicated formulas for $\pi(m)$ and $p_n$ correct? Oct 27, 2015 at 13:35
• Possible duplicate of Formula for prime counting function Oct 27, 2015 at 13:38
• Ah, well, you see this is why it is important to be clear what the question is. You say "I have to" with regard to $H(j)$, but you are less clear about the need to show the formula for $p_n$. Oct 27, 2015 at 13:44

1 Answer

The key fact in the formulae above is Wilson's theorem:

If $n$ is prime, then $(n-1)!+1$ is divisible by $n$.

And the slightly more obvious:

If $n$ is composite, then $(n-1)!$ is divisible by $n$.

Let's state upfront, though: These formula are essentially "nonsense," in that they add zero knowledge beyond our knowledge from Wilson's theorem, and are certainly not computationally useful.

Formula 1

$$\theta_j = \pi\frac{(j-1)!+1}{j}$$

will be a multiple of $\pi$ if $j$ is prime, and something else if $j$ is not prime. So $\cos^2\theta_j = 1$ if $j$ is prime and otherwise it is some value in $[0,1)$ so

$$\left\lfloor \cos^2\theta_j \right\rfloor = \begin{cases}1&\text{if j is prime or j=1}\\ 0&\text{if j composite} \end{cases}$$

The case $j=1$ is why there is a $-1$ added to the sum above.

Formula 2

The second case has $H(j)=F(j)$ for $j>1$. It's not actually defined when $j=1$, so you'd have to deal with that to fix it.

If $j$ is composite, then $\pi\frac{(j-1)!^2}{j}$ is a multiple of $\pi$, so the numerator is zero, so $H(j)=0$.

When $j$ is prime, then $\pi\frac{(j-1)!^2}{j} = \frac{\pi}{j}+M\pi$ for some integer $M$, so the sine of this angle is $\pm\sin \frac{\pi}{j}$, and therefore the square of the quotient is $1$.

Formula 3

The last formula can be rewritten as:

$$p_n=1+\sum_{m=1}^{2^n} \left\lfloor\left(\frac{n}{1+\pi(m)} \right )^{1/n} \right\rfloor$$

But it is easy to show that $n^{1/n}<2$ for all $n$, and thus

$$\left\lfloor\left(\frac{n}{1+\pi(m)} \right )^{1/n}\right\rfloor=\begin{cases}1&\text{if }\pi(m)<n\\ 0&\text{otherwise} \end{cases}$$

Since the first $n$ primes are known to be less than $2^n$, this sum counts all $m$ with $\pi(m)<n$, which is is $p_n-1$. Adding $1$ gives $p_n$.

• Just do not understand where you put it $n^{1/n}<1$. Oct 27, 2015 at 17:55
• @marcelolpjunior Whoops, that statement is wrong, should be $n^{1/n}<2$. Fixed. Thanks! Oct 27, 2015 at 17:56
• I thank you. I can prove it by induction? Making for $n = 1$ is valid, taking $n = k$ to true, can I use inequality $(k+1)^{1/(k+1)}<k^{1/(k+1)}<k^{1/k}<2$? Oct 27, 2015 at 18:14
• It's easer to use calculus, and show that $x^{1/x}$ has a maximum at $x=e$, and then show that $e^{1/e}<2$. Oct 27, 2015 at 18:15
• $4$ does not divide $(4-1)!$ Dec 13, 2019 at 19:08