# Is this formula for the $n^{th}$ prime number useful?

Is the below formula for the $n^{th}$ prime number in elementary functions useful somehow?

$$p(n)=\sum _{a=2}^{2^n} \sin \left(\pi 2^{\left(n-\sum _{b=2}^a \frac{\sin ^2\left(\frac{\pi }{b}((b-1)!)^2\right)}{\sin ^2\left(\frac{\pi }{b}\right)}\right)^2-1}\right)\frac{a \sin ^2\left(\frac{\pi }{a} ((a-1)!)^2\right) }{\sin ^2\left(\frac{\pi }{a}\right)}.$$

-
How widely have you looked for elementary formulas for primes? Have you looked at Hardy and Wright? at Crandall and Pomerance? at Niven, Zuckerman, and Montgomery? at MathSciNet? –  Gerry Myerson Jun 9 '11 at 12:30
Hello Gerry, please forgive my ignorance but I am not familiar with these authors. –  Athanasios Evangelou Jun 9 '11 at 13:46
@A. E.: if you're not familiar with G.H. Hardy, then you have some rather delightful reading ahead of you! And I heartily encourage you to read more into the number theory; believe it or not, things get even more fascinating once you get past the 'surface' of quirky formulas like the one you found and into the meat of the subject. –  Steven Stadnicki Jun 10 '11 at 2:14
Eh, I do not know if this is the place to say so, since the lack of experience, but, judging from my narrow view, the branch of mathematics named analytic number-theory is $not$ number-theory at all; moreover, as Weil put it, Hardy is not a number-theorist. If one can gain insights into number-theory, as the author wants, then tell me so as to correct my wrong view, thanks. P.S. My view does not matter as a commonly accepted knowledge, and I put it here just to judge this. –  awllower Jun 10 '11 at 7:37
"analytic number theory is not number theory" is meaningless without a definition of terms. –  Gerry Myerson Jun 10 '11 at 12:24

## 2 Answers

Every "elementary" formula I know of is a disguised implementation of a slow algorithm for testing whether a number is prime. For actually computing primes, it's better just to directly implement a fast primality testing algorithm, of which there are many. For actually proving something about primes, experience has shown that it's better to either ask for asymptotic rather than exact information or to use more sophisticated techniques (e.g. the Riemann zeta function).

A basic reason formulas like the one you give are not useful for proving anything is that they involve the cancellation of many terms, and there's no way to extract reliable asymptotic information without knowing much more about how the terms cancel.

-
Also I think I may have misunderstood the definition of elementary. From Mathworld : "A function built up of a finite combination of constant functions, field operations (addition, multiplication, division, and root extractions--the elementary operations)--and algebraic, exponential, and logarithmic functions and their inverses under repeated compositions (Shanks 1993, p. 145; Chow 1999)." But does this definition include repeated summation/multiplication as in the formulae I gave ? –  Athanasios Evangelou Jun 10 '11 at 1:13
@A. E.: not only does it not include 'indefinite' summations or products (i.e., those whose bounds are functions rather than constants), it also doesn't include the factorial function (which could be viewed as such an indefinite product), so your functions are 'non-elementary' in two different fashions. –  Steven Stadnicki Jun 10 '11 at 2:09
I would argue that by your definition it is non-elementary in exactly one fashion, since $$n!=\prod _{i=1}^n i=\exp \left(\sum _{i=1}^n \ln (i)\right)$$, but I get the point ! –  Athanasios Evangelou Jun 10 '11 at 2:33

C P Willans, On formulae for the $n$th prime, Math Gazette 48 (1964) 413-415 gives $$\pi(m)=\sum_2^m(\sin^2\pi{((j-1)!)^2\over j})/\sin^2(\pi/j))$$ This is quoted in Paulo Ribenboim, The Little Book of Bigger Primes.

-