I have two recursion equations that seem to be equivalent. I need a method to show the equivalence relation between them. The equations calculate number of ones in binary representation of the number. The equations are given below:
1) $$ f(0) = 0 $$ $$ f(n) = \begin{Bmatrix} f(n-1)+1 & \text{if n is odd} \\ f(\frac{n}{2}) & \text{if n is even} \end{Bmatrix} $$
2) $$ g(0) = 0$$ $$g(n)=g(n-2^{\lfloor log_2{(n)}\rfloor})+1$$
I thought about using induction, but I have no clue how to use it along with recursive equations. Any help will be appreciated.
The most obvious strategy would be to prove separately that $f(n)$ and $g(n)$ are both equal to the number of ones in the binary representation of $n$. That would be fairly easy to do by long induction on $n$ in each case.