Approximation for a Fractal Function

30 Views Asked by At

I have recently been working on a problem that requires division by the highest $n$ such that $n = 2^{k}$ and both $n$ and $k$ are integers. To find this $n$ value, I made the function: $$f(x)=\sum_{n=0}^{\text{log}_{2}x}2^{n}\left( \left\lfloor \frac{x}{2^{n}} \right\rfloor\left\lfloor \frac{x-1}{2^n}+1 \right\rfloor \text{mod}\ 2 \right)$$. Basically, I am looking for an approximation that is accurate for integer $x$ values. Or, if there is some way to simplify this function that could also work. (when graphed the function looks like: highest power of $2$ that divides $n$). Any help is appreciated