Proving if $g(n)=\left\{\begin{smallmatrix}5n-1&n\text{ is odd}\\n/4\ &\ n\text{ is even}\end{smallmatrix}\right.$ is primitive recursive

50 Views Asked by At

Is $g$ primitive recursive and if so, prove it, where $$g(n) = \begin{cases} 5n - 1 & n \text{ is odd} \\ \lfloor n/4 \rfloor & n \text{ is even}\end{cases}$$

I have access to the predecessor, multiplication functions and bounded minimisation (don't need to prove that they're primitive recursive).

When $n$ is odd, $g(n) = Pred(m(5,n))$, where Pred is the predecessor function and $m$ is the multiplication function. When $n$ is even, $g(n) = max_{m \le n} : m(4,m) \le n $

I'm not sure how to properly define this with a dummy variable or if my definition is primitive recursive for when $n$ is even, so any help there would be appreciated. I'm also not sure how to define $g(n+1)$ from $g(n)$ (this is how I've defined primitive recursion before).