Solution (source code)

= Solution

If $f$ is primitive recursive, then $d(n)=f(P_1^1(n),P_1^1(n))$ is obtained by composition with projections. Hence the diagonal is primitive recursive.