How to prove that $f:N^3\rightarrow N,$ $f(x,y,z)=max\{x,y,z\}$ is a primitive-recursive function?
First, for $f(x,y,0)=max\{x,y,0\}=max\{x,y\}=y+(x\ monus\ y)$, and $+$ and $monus$ are primitive-recursive functions.
$f(x,y,z+1)=f(x,y,z)$ if $z+1<x$ or $z+1<y$
$f(x,y,z+1)=f(x,y,z)+1$ if $z+1\geqslant x$ or $z+1\geqslant y$
Is this enough or should I have to solve it further? How could I do that?