Floor and Ceiling functions

198 Views Asked by At

I have been trying to proof ⌊log_2(⌈n/k⌉)⌋ = ⌊log_2(n/k)⌋, but I never learned any rules with floor and ceiling functions. I am not sure if this theorem is true either. So my question is: Is it safe to say ⌊log_2(⌈n/k⌉)⌋ = ⌊log_2(n/k)⌋ ?

1

There are 1 best solutions below

1
On

It is not always true.

E.g. if $n=7$ and $k=5$ then $$\lfloor \log_2(\lceil 1.4 \rceil) \rfloor = \lfloor \log_2(2) \rfloor =\lfloor 1 \rfloor = 1$$

while $$\lfloor \log_2( 1.4 ) \rfloor = \lfloor 0.485\ldots \rfloor =0.$$

It is not true when $n/k$ is not an integer but rounds up to a power of $2$.