Skip to main content
1 of 4

Show that the function $$f(x)=\begin{cases}1,&\text{if $x$ is prime;}\\\0,&\text{otherwise}\end{cases}$$ is primitive recursive. Then show that given any primitive recursive function $f:\mathbb N\to\mathbb N$, the function $g:\mathbb N\to\mathbb N$ such that $g(x)=\sum_{y=1}^xf(x)$ is also primitive recursive. Then adapt this to prove what you want.