Every positive integer $n$ has a unique factorization $2^l \cdot m$, consider $f(n) = l + m$. Is there a closed-form of $f(n)$ based on $n$ where $l$ is nonnegative integer and $m$ is a positive odd integer.
I broke this into cases.
I found that for odd numbers $f(n) = n$
For powers of $2$, it is just $f(n) = \log_2(n) + 1$
I am unable to find it for even numbers that aren't power of $2$. Any advice?
Denoting $v_2(n)$ the dyadic valuation of $n$, i.e. the exponent of $2$ in the prime powers decomposition of $n$, you can write $$f(n)=v_2(n)+\frac n{2^{v_{2}(n)}}.$$