0

I am trying to solve a problem where I get in the solution that the answer is $\lfloor \log_{2}(n-1) \rfloor + 1$, but the solution book has as an answer the value $\lceil \log_{2}(n) \rceil$. I was wondering are these two exactly the same?

I plotted their difference on wolframalpha and it seems to be $0$.

Teddy38
  • 3,309
jsguy
  • 93

1 Answers1

2

First check that the following claim is true.

If $x<y$ and there is no integer in the open interval $(x,y)$, then $\lfloor x \rfloor + 1 = \lceil y \rceil.$

Now convince yourself that there is no integer strictly between $\log_2(n-1)$ and $\log_2(n)$.

angryavian
  • 89,882