ruveyn wrote:
Is there a computable function F such that F(n) is the n-th prime?
F(1) = 2
F(2) = 3
F(3) = 5
and so on.
ruveyn
F(n) = if (n=1) then 2 else X(F(n-1)+1)
X(n) = if (P(n) = 1) then n else X(n+1)
P(n) = if (D(n-1, n) = 0) then 1 else 0
D(i, n) = if (i <= 1) then 0 else (if (i | n) then 1 else D(i-1, n))
D(i, n) returns 1 when some number greater than 1 and less than or equal to i divides n.
P(n) returns 1 if n is prime.
X(n) returns the smallest prime equal to or greater than n.
F(n) returns the nth prime number.
Not fast at all, but computable.
_________________
"A dead thing can go with the stream, but only a living thing can go against it." --G. K. Chesterton