# Function generating all primes?

As far as I know, no one has been able to find an onto function $f:\mathbb{N} \rightarrow P$ where $P$ is the set of all primes. Does there exist an onto function $f: \mathbb{N}\times \mathbb{N} \rightarrow P$ where $P$ is the set of all primes? Finally, is there any general onto function $f:\mathbb{N}^k \rightarrow P$, where $k \in \mathbb{N}$? Of course what i want is a closed form that is, something like a formula. Not a function like f(n)= nth prime number.

• Sure there is an onto function $f:\mathbb N \rightarrow P$. Take for instance $f(n) = p_n$, the $n$th prime. If you want a formula instead, that's a different question. Sep 29, 2015 at 18:45
• @TonyK obviously I am talking about a function with a close form, something like a formula. Sep 30, 2015 at 10:13
• Yes, obviously. But if you are going to ask such questions, it's important that you get the terminology right. Sep 30, 2015 at 11:58
• @TonyK I apologize for my mistake, yeah I should have said closed form... Sorry.... Yes a open form is what i want..... :) Oct 1, 2015 at 9:20
• Your question is too broad to admit a precise answer (are you only interested in polynomials, or some broader class of "formulas"?), but this might be a good place to do some background reading: en.wikipedia.org/wiki/Formula_for_primes Oct 6, 2015 at 17:09