# What is the max possible value of $2i-2^{\lceil{\log{i}}\rceil}$ when the base of log is 2?

I have an expression of the form $2i-2^{\lceil{\log{i}}\rceil}$ . I want to know the maximum value of $2i-2^{\lceil{\log{i}}\rceil}$ .

Please consider the base of the logarithm as 2.

-
Of course, since $\log i$ can become arbitrary large, so can $2^{\lceil\log i\rceil}$. However, I guess you meant something different. Maybe you want the maximal value of $2^{\lceil\log i\rceil}/i$? –  celtschk Sep 12 '12 at 16:28
@celtschk I corrected yet . thanks for pointing out. –  Geek Sep 12 '12 at 16:32
@Geek Originally you wanted a lower bound on $2i-2^{\lceil{\log{i}}\rceil}$. Are you sure you don't want the minimum possible value now? –  Erick Wong Sep 12 '12 at 17:33

Let $\log i=I+f\implies i=2^I.2^f$.

If $f\neq0$, then, $\lceil\log i\rceil=I+1\implies 2i-2^{\lceil\log i\rceil}=2^{I+1}2^f-2^{I+1}=2^{I+1}(2^f-1)$

Since $f\gt 0$ and $I$ can go arbitrarily large(depending on $i$), so this difference is unbounded.

If $f=0$, then, $\lceil\log i\rceil=I\implies 2i-2^{\lceil\log i\rceil}=2^{I+1}-2^{I}=2^{I}$ which is unbounded too (depending on $i$)

-

If $i$ is $2^k+1$, $\lceil \log i \rceil = k+1$, so $2^{\lceil \log i \rceil} =2^{ k+1}$ and $2i-2^{\lceil \log i \rceil}=2i-2(i+1)=2$. If $i$ is further from a power of $2$, the expression will decline.

-
Can you explain why If $i$ is $2^k+1$, $\lceil \log i \rceil = k+1$ –  Geek Sep 12 '12 at 16:33
The definition of $\log$ gives you that $k = \log 2^k$ whether k is integral or real. If you take $\log (2^k+1)$ for $k$ integral, it will be a little higher than $k$, so will round up to $k+1$ –  Ross Millikan Sep 12 '12 at 16:37
@RossMillikan You have an extra factor of $2$ in $2(2i-2)$. The expression should always be positive since $\lceil \log i \rceil < \log i + 1$. –  Erick Wong Sep 12 '12 at 17:29
@ErickWong: right. fixed. Thanks –  Ross Millikan Sep 12 '12 at 18:03
@Geek: Please see the correctiion –  Ross Millikan Sep 12 '12 at 18:03
Let $u(x)=2x-2^{\lceil\log_2 x\rceil}$, then $x=2^n\sqrt2$ with $n$ integer yields $\lceil\log_2 x\rceil=n+1$ hence $u(x)=2^{n+1}(\sqrt2-1)\to+\infty$ when $n\to+\infty$.
To deal with $u(i)$ for $i$ integer, define $i_n$ as the unique integer such that $i_n\leqslant2^n\sqrt2\lt i_n+1$. Then $2i_n\gt2^{n+1}\sqrt2-2$ and $\lceil\log_2 i_n\rceil\leqslant n+1$ hence $u(i_n)\geqslant2^{n+1}(\sqrt2-1)-2$.
In particular, $u(i_n)\to+\infty$ when $n\to+\infty$, hence the family $\{u(i)\mid i\in\mathbb N\}$ is unbounded.
Likewise, for every real number $a\gt1$, the family $\{ai-a^{\lceil\log_ai\rceil}\mid i\in\mathbb N\}$ is unbounded.