Set of Prime Numbers is Primitive Recursive

Theorem
The set $\Bbb P$ of prime numbers is primitive recursive.

Proof
A prime number is defined as an element of $\N$ with exactly two positive divisors.

So, we have that $n > 0$ is prime iff $\tau \left({n}\right) = 2$, where $\tau: \N \to \N$ is the tau function.

Thus we can define the characteristic function of the set of prime numbers $\Bbb P$ as:
 * $\forall n > 0: \chi_\Bbb P \left({n}\right) := \chi_{\operatorname{eq}} \left({\tau \left({n}\right), 2}\right)$

Now we let $g: \N^2 \to \N$ be the function given by:
 * $\displaystyle g \left({n, z}\right) = \begin{cases}

0 & : z = 0 \\ \displaystyle \sum_{y \mathop = 1}^z \operatorname{div} \left({n, y}\right) & : z > 0 \end{cases}$

Since: then $g$ is primitive recursive.
 * $\operatorname{div}$ is primitive recursive
 * $\displaystyle \sum_{y \mathop = 1}^z$ is primitive recursive

Then for $n > 0$:
 * $\displaystyle g \left({n, n}\right) = \sum_{y \mathop = 1}^n \operatorname{div} \left({n, y}\right) = \tau \left({n}\right)$

and from Tau Function is Primitive Recursive we have that $g$ is primitive recursive.

Then let $h: \N \to \N$ be the function defined as:
 * $h \left({n}\right) = g \left({n, n}\right)$

which is also primitive recursive.

So we have, for all $n \in \N$:
 * $\chi_\Bbb P \left({n}\right) = \chi_{\operatorname{eq}} \left({h \left({n}\right), 2}\right)$

Hence the result.