Proving that $\lfloor n\rfloor -\left\lfloor\frac{n}{2^{k+1}}\right\rfloor=\lfloor n\rfloor$

ceiling-and-floor-functionsdiscrete mathematics

How can I prove this?
$$\lfloor n\rfloor -\left\lfloor\frac{n}{2^{k+1}}\right\rfloor=\lfloor n\rfloor$$

I considered the base case, $k=0$

$$\lfloor n\rfloor -\left\lfloor\frac{n}{2}\right\rfloor=\lfloor n\rfloor -0=\lfloor n\rfloor$$

But this is only valid if $n<1$. Then if $k\longrightarrow \infty $, the problem is changing only if $n$ is small enough so that $\left\lfloor\frac{n}{2}\right\rfloor=0$. So I am not sure how to prove that.

Any hints appreciated.

Thanks

Best Answer

The required condition is that $$\left\lfloor\frac{n}{2^{k+1}}\right\rfloor=0$$

This is only true if

$$0\leq n<2^{k+1}\iff k > \log_2\left(\frac{n}{2}\right)$$

Related Question