This is related to Collatz sequence, which is that $$C(n) = \begin{cases} n/2 &\text{if } n \equiv 0 \pmod{2}\\ 3n+1 & \text{if } n\equiv 1 \pmod{2} .\end{cases}$$
Is it possible to describe the Collatz function in one formula? (without modular conditions)
$$f(n)=\frac74n+\frac12+(-1)^{n+1} \left(\frac54n+\frac12\right)$$