Not All URM Computable Functions are Primitive Recursive

Theorem
There exist URM computable functions which are not primitive recursive.

Proof
Consider the basic primitive recursive functions.

To each basic primitive recursive function $$f$$ let us assign a code number $$\delta \left({f}\right)$$, as follows:


 * $$\delta \left({\operatorname{zero}}\right) = 3$$;
 * $$\delta \left({\operatorname{succ}}\right) = 9$$;
 * $$\forall k, m \in \N^*: m \le k: \delta \left({\operatorname{pr}^k_m}\right) = 2^k 3^m$$.

Suppose the function $$h$$ is defined by substitution from the functions $$f, g_1, g_2, \ldots, g_t$$ to which we have already assigned code numbers.

Then we put:
 * $$\delta \left({h}\right) = 2^{\delta \left({f}\right)} 3^{\delta \left({g_1}\right)} 5^{\delta \left({g_2}\right)} \cdots p_{t+1}^{\delta \left({g_t}\right)} + 1$$.

Suppose the function $$h$$ is defined by primitive recursion from the functions $$f$$ and $$g$$ to which we have already assigned code numbers.

Then we put:
 * $$\delta \left({h}\right) = 2^{\delta \left({f}\right)} 3^{\delta \left({g}\right)} + 2$$.

Thus we assign a code number to every definition of a primitive recursive function.

Given any natural number $$m$$ we can determine whether $$m$$ is the code number for a definition of a primitive recursive function, and if so, work out what definition it encodes.

In particular, given any such $$m$$ we can work out whether it encodes a primitive recursive function $$f: \N \to \N$$, and determine how $$f$$ is built up from basic primitive recursive functions on up.

From this definition, we can compute all the values of $$f$$ for all inputs $$n \in \N$$.

So, we define the function $$\Phi: \N^2 \to \N$$ as follows:
 * $$\Phi \left({m, n}\right) = \begin{cases}

f \left({n}\right) & : \text{if } m \text { codes a definition of the primitive recursive function } f: \N \to \N \\ 0 & : \text{otherwise} \end{cases}$$

It is deducible by arguments derived from proofs of the various primitive recursive functions that there is a URM program for computing the values of $$\Phi$$.

That is, $$\Phi$$ can be shown to be URM computable

Now we apply Cantor's Diagonal Argument to create the following URM computable function $$g: \N \to \N$$:
 * $$g \left({n}\right) = \Phi \left({n, n}\right) + 1$$.

We have that $$\Phi$$ is URM computable.

So it follows that $$g \left({n}\right)$$ is also URM computable.

Now, let $$f$$ be a primitive recursive function and let $$m$$ code some definition of $$f$$.

So, for all $$n \in \N$$, we have:
 * $$f \left({n}\right) = \Phi \left({m, n}\right)$$.

Thus $$f \left({m}\right) = \Phi \left({m, m}\right)$$.

Now, since $$g \left({m}\right) = \Phi \left({m, m}\right) + 1$$, we see that $$g \left({m}\right) \ne f \left({m}\right)$$, whatever $$f$$ may happen to be.

Hence $$g \ne f$$.

So $$g$$ is different from any primitive recursive function $$f$$ that we care to devise.

Therefore $$g$$ is a URM computable function which is not primitive recursive.

Hence the result.