Highest power of 4 that divides n

91 Views Asked by At

Let $n\in\mathbb{N}$ or $\mathbb{Z^+}$.

I know there are some ways to compute/find the highest power of $2$ that divides $n$, there's the ruler sequence, and some ways to do this with boolean algebra as well. But takes iterative function or recursive process.

But I am wondering if there is a function or way to find the highest power of $4$ that divides $n$, there doesn't seem to be much literature on this, atleast not when I tried to google. The only thing I found was something in which the sums of nonnegative integers is never a square that I do not understand anything about (Don't have the technical knowledge). That list only seem to give the indices or actual numbers that can be divided by a power of $4$ to get an odd number.

Im wondering if there exist an expression to compute the exponent. What I have so far is only a small list of the mappings of the numbers to the exponents.

$4\rightarrow1$

$12\rightarrow1$

$16\rightarrow2$

$20\rightarrow1$

$28\rightarrow1$

$36\rightarrow1$

$44\rightarrow1$

$48\rightarrow2$

and so on. Note numbers/indices between $0$ and $4$, $4$ and $12$ and so on are only $0$'s.

So as an example: Let $b=2$ (as seen from the mapping): $$\frac{48}{4^b} = 3$$

Is it likely possible to have a function that can compute these mappings?

1

There are 1 best solutions below

0
On BEST ANSWER

If the highest power of $2$ that divides $n$ is $2^d$, then the highest power of $4$ that divides $n$ is $4^{d/2}$ if $d$ is even, $4^{(d-1)/2}$ if $d$ is odd.