# Thread: A prime returning function?

1. ## A prime returning function?

Is there such a fuction of the form $\displaystyle P(n)$ which returns the $\displaystyle nth$ prime number? The function would be such that:

$\displaystyle P(1) = 2$
$\displaystyle P(2) = 3$
$\displaystyle P(3) = 5$
$\displaystyle P(4) = 7$
$\displaystyle P(5) = 11$
.
.
.
.

I think the idea is clear. Is there such a function? Or reasearch on such a function?

2. Originally Posted by mfetch22
Is there such a fuction of the form $\displaystyle P(n)$ which returns the $\displaystyle nth$ prime number? The function would be such that:

$\displaystyle P(1) = 2$
$\displaystyle P(2) = 3$
$\displaystyle P(3) = 5$
$\displaystyle P(4) = 7$
$\displaystyle P(5) = 11$
.
.
.
.

I think the idea is clear. Is there such a function? Or reasearch on such a function?
If you don't need to go very high, you could write a sieve. Here's a website that allows you to find the nth prime for n up to $\displaystyle 10^{12}$.

3. Originally Posted by mfetch22
Is there such a fuction of the form $\displaystyle P(n)$ which returns the $\displaystyle nth$ prime number? The function would be such that:

$\displaystyle P(1) = 2$
$\displaystyle P(2) = 3$
$\displaystyle P(3) = 5$
$\displaystyle P(4) = 7$
$\displaystyle P(5) = 11$
.
.
.
.

I think the idea is clear. Is there such a function? Or reasearch on such a function?
Formula for primes - Wikipedia, the free encyclopedia

This is as close as you can get to a true prime number formula.

4. Originally Posted by chiph588@
Formula for primes - Wikipedia, the free encyclopedia

This is as close as you can get to a true prime number formula.
That polynomial inequality in 26 variables is trippy! Thanks for the link.

5. Of much interest is also Riemann's "explicit formula"!