I am trying to find a function that perfectly defines the first iteration of the Collatz Conjecture. Is this good enough? Or is there a better and more compact function?
$f\left(x\right)=\left(\frac{x}{2}-\operatorname{floor}\left(\frac{x}{2}\right)\right)\cdot2\cdot\left(3x+1\right)+\left(1-\left(\left(\frac{x}{2}-\operatorname{floor}\left(\frac{x}{2}\right)\right)\cdot2\right)\right)\cdot\frac{x}{2}$