# A prime returning function?

• Jun 9th 2010, 08:38 AM
mfetch22
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?
• Jun 9th 2010, 08:48 AM
undefined
Quote:

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}$.
• Jun 9th 2010, 09:13 AM
chiph588@
Quote:

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.
• Jun 9th 2010, 09:22 AM
undefined
Quote:

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.
• Jun 9th 2010, 09:23 AM
Bruno J.
Of much interest is also Riemann's "explicit formula"!