# Math Help - A prime returning function?

1. ## A prime returning function?

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

$P(1) = 2$
$P(2) = 3$
$P(3) = 5$
$P(4) = 7$
$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 $P(n)$ which returns the $nth$ prime number? The function would be such that:

$P(1) = 2$
$P(2) = 3$
$P(3) = 5$
$P(4) = 7$
$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 $10^{12}$.

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

$P(1) = 2$
$P(2) = 3$
$P(3) = 5$
$P(4) = 7$
$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"!