Define primitive recursive function

160 Views Asked by At

(it's not homework, this question is supposed to be supplementary material for students to understand the lecture material better!)

I have specific function that needs to be proved to be primitive recursive, however I have some difficulties on how to start tackling such problem.

Having $f: \mathbb{N} \to \mathbb{N}$ defined as the number of integer numbers that divide a natural number, $$f(n)=\begin{cases}0,&\text{ when } n=0\\|\{a\in\Bbb N\mid\exists b\in\Bbb N: a*b=n\}|,&\text{ otherwise}\end{cases}$$

An example output would be $f(6)=4$ as $6$ is divisible by four integers $1,6,2,3$.

In order to define such function no LOOP/WHILE/GOTO programms are allowed.