Divisor Count Function is Primitive Recursive

Theorem
The divisor counting ($\tau$) function is primitive recursive.

Proof
The divisor counting function $\tau: \N \to \N$ is defined as:
 * $\displaystyle \map \tau n = \sum_{d \mathop \divides n} 1$

where $\displaystyle \sum_{d \mathop \divides n}$ is the sum over all divisors of $n$.

Thus we can define $\map \tau n$ as:
 * $\displaystyle \map \tau n = \sum_{y \mathop = 1}^n \map {\operatorname {div} } {n, y}$

where
 * $\map {\operatorname {div} } {n, y} = \begin{cases}

1 & : y \divides n \\ 0 & : y \nmid n \end{cases}$

Hence $\tau$ is defined by substitution from:
 * the primitive recursive function $\operatorname {div}$
 * the primitive recursive bounded summation $\displaystyle \sum_{y \mathop = 1}^n$.

Hence the result.