Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Possible Duplicate:
Is there a known mathematical equation to find the nth prime?

Is there a function, like f(n), I insert n into the function and it outputs nth prime number? I have been trying to find a pattern between the prime numbers, 1st differences, 2nd differences, but I can't find it.

To be clear: I want something like f(x)=x^2+5 or f(x)=2.sin(x)+x^2. You know what I mean...

share|improve this question

marked as duplicate by Charles, Ross Millikan, Chris Eagle, Zev Chonoles Jan 2 '12 at 17:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5  
Yes. You've just defined it, in fact. You probably actually want some sort of formula for primes (q.v.) though. –  Chris Eagle Jan 2 '12 at 16:46
2  
Sure. Let $f(n)$ be the function that inputs $n$ and outputs the $n$-th prime number. :) Less obnoxiously, you have to be more specific about the form of the function you're looking for. Closed-form expressions exist but are pretty computationally useless, usually relying on something like Wilson's theorem to function as a characteristic function for the primes. –  Cam McLeman Jan 2 '12 at 16:47
    
I updated my question to be more clear –  PragmaOnce Jan 2 '12 at 16:53
    
I think Chris's wikipedia link should answer your question sufficiently. –  Cam McLeman Jan 2 '12 at 16:57
add comment

1 Answer 1

Well yes, the function $f$ does exist, but that doesn't mean we know what it looks like.

share|improve this answer
7  
It looks like {(1, 2), (2, 3), (3, 5), (4, 7), ...}. The OP no doubt intends a closed-form formula rather than a function, but that will depend on her/his definition of "closed-form". –  Charles Jan 2 '12 at 16:55
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.