I'm looking for a (simple) formula $t: \mathbb{N} \rightarrow \mathbb{N}$ to compute the number of trailing zeroes in the binary representation of a given $n \in \mathbb{N}$.
Like so:
$t(1) = t([1]_2) = 0$
$t(2) = t([10]_2) = 1$
$t(3) = t([11]_2) = 0$
$t(4) = t([100]_2) = 2$
etc.
I once found a rather complex formula back in 2016, that actually works, but is very clunky:
$t(n) = \sum_{k=1}^\infty cos( \frac{1}{2^k} \pi n) \prod_{j=1}^k cos( \frac{1}{2^j} \pi n)$
The basic idea behind this one is to sum cosines, which become $1$ at some $2^k$ and $0$ otherwise. It works, is provable by induction and I have worked with it, like e.g. here (sorry for IEEE paywall, it is just an example and not that much of importance).
However, I am still wondering, if there isn't any better or more simple way to describe $t(n)$, as the above formula is really hard to use. It also relies on non-integer functions (cosine), despite $t(n)$ being an $\mathbb{N} \rightarrow \mathbb{N}$ function.
Any ideas? Thanks in advance!