Set of Sequence Codes is Primitive Recursive

Theorem
Let $$\operatorname{Seq}$$ be the set of all code numbers of finite sequences in $$\N$$.

Then $$\operatorname{Seq}$$ is primitive recursive.

Proof
We are to show that the characteristic function $$\chi_{\operatorname{Seq}}$$ of $$\operatorname{Seq}$$ is primitive recursive.

Let $$p: \N \to \N$$ be the prime enumeration function.

Let $$\operatorname{len} \left({n}\right)$$ be the length of $$n$$.

We note that $$\chi_{\operatorname{Seq}} \left({n}\right) = 1$$ iff $$p \left({y}\right)$$ divides $$n$$ for $$1 \le y \le \operatorname{len} \left({n}\right)$$.

That is, iff $$\operatorname{div} \left({n, p \left({y}\right)}\right) = 1$$ for $$1 \le y \le \operatorname{len} \left({n}\right)$$, where $$\operatorname{div}$$ is the divisor relation.

We then see that $$\operatorname{div} \left({n, p \left({y}\right)}\right) = 1$$ for $$1 \le y \le \operatorname{len} \left({n}\right)$$ iff their product equals $$1$$.

So we can define $$\chi_{\operatorname{Seq}}$$ by:
 * $$\chi_{\operatorname{Seq}} \left({n}\right) = \begin{cases}

\prod_{y=1}^{\operatorname{len} \left({n}\right)} \operatorname{div} \left({n, p \left({y}\right)}\right) & : n > 1 \\ 0 & : \text{otherwise} \end{cases}$$

Then we define $$g: \N^2 \to \N$$ as:
 * $$g \left({n, z}\right) = \begin{cases}

1 & : z = 0 \\ \prod_{y=1}^z \operatorname{div} \left({n, p \left({y}\right)}\right) & : z \ne 0 \end{cases}$$

We then apply Bounded Product is Primitive Recursive to the primitive recursive function $$\operatorname{div} \left({n, p \left({y}\right)}\right)$$, and see that $$g$$ is primitive recursive.

Finally, we have that:
 * $$\chi_{\operatorname{Seq}} \left({n}\right) = \begin{cases}

g \left({n, \operatorname{len} \left({n}\right)}\right) & : n > 1 \\ 0 & : \text{otherwise} \end{cases}$$ is obtained by substitution from: So $$\chi_{\operatorname{Seq}}$$ is primitive recursive.
 * the primitive recursive function $\operatorname{len}$;
 * the primitive recursive function $$g$$;
 * the primitive recursive relation $>$;
 * the constant $1$.

Hence the result.