Solving an inequality involving a floor

126 Views Asked by At

Increasing the integer $k$, I can make the floor of $L/k$ smaller than $r$:

$$\left\lfloor \frac{L}{k} \right\rfloor \lt r$$

where $L, k, r$ are positive integers, $k\leq \lfloor \frac{L}{2} \rfloor$.

Is it possible to write down a "closed form" (or whatever easily computable expression, possibly through low and upper bounds) for the first integer $k$ where the displayed inequality holds true ?

2

There are 2 best solutions below

2
On BEST ANSWER

We want the first $k$ with $\frac Lk<\lceil r\rceil$, which is the first $k$ with $\frac L{\lceil r\rceil }<k$, i.e., $$ k=1+\left\lfloor \frac L{\lceil r\rceil }\right\rfloor$$

Edit: I just see that $r$ is an integer, so my writing $\lceil r\rceil$ is unnecessarily cautious, we can simplify to $$ k=1+\left\lfloor \frac L{r}\right\rfloor,$$ but note that this is not the same as $\lceil \frac L r\rceil$ because $r$ may be a divisor of $L$.

4
On

Note that as you increase $k$, $L/k$ decreases monotonically. Thus, the first value $k$ satisfying this inequality satisfies $$\left\lfloor \frac{L}{k}\right\rfloor <r\le\left\lfloor \frac{L}{k-1}\right\rfloor.$$ Now, since $r$ is a positive integer, this occurs iff $$ \frac{L}{k} <r\le \frac{L}{k-1}.$$ or equivalently $$\frac{L}{r}-1< k-1\le \frac{L}{r}.$$ Then since $k-1$ is a positive integer $$k-1=\left\lfloor\frac{L}{r}\right\rfloor,$$ so $$k=\left\lfloor\frac{L}{r}\right\rfloor+1.$$