Solving an equation that contain floor function

ceiling-and-floor-functionsnumber theorysystems of equations

Let suppose I have three positive integers $a, b,c$ and one unknown $x$ ($x$ is also a positive integer). Solve for the smallest $x$ that satisfies this equation

$$\left \lfloor\frac{x}{a} \right\rfloor + \left \lfloor \frac{x}{b} \right\rfloor \geq c$$

where $\lfloor x\rfloor$ is the floor function

For instance let $a = 1$, $b=1$ and $c=5$ in this case

$$\left \lfloor x \right\rfloor + \left \lfloor x \right\rfloor \geq 5$$

here the smallest $x$ is $3$.

For another case, if $a=3$ and $b=5$ and $c=4$ we obtain

$$\left \lfloor\frac{x}{3} \right\rfloor + \left \lfloor \frac{x}{5} \right\rfloor \geq 4$$

here the smallest $x$ is $9$

My question is, can we find the smallest $x$ exactly ?

Best Answer

Assume that $a,b,c$ are positive .

Let $y=\frac{abc}{a+b}$. Then $$\frac{y}{a}+\frac{y}{b}=c.$$

Therefore $$\left \lfloor\frac{y}{a} \right\rfloor + \left \lfloor \frac{y}{b} \right\rfloor$$ will be either $c$ or $c-1$.

If it is $c$

Then $y$ is a solution. We will still have a solution when $y$ is increased, until $y$ becomes the next multiple of either $a$ or $b$.

If it is $c-1$

Then increase $y$ until it becomes the next multiple of either $a$ or $b$. This will be the solution $x$ unless it is a multiple of both $a$ and $b$ in which case there is no solution. Given that we have a solution $x$, then we can increase it as above until the next multiple of either $a$ or $b$ is reached.

Example

Solve $\left \lfloor\frac{x}{5} \right\rfloor + \left \lfloor \frac{x}{7} \right\rfloor=8.$

We obtain $y=70/3$ and then $\left \lfloor\frac{y}{5} \right\rfloor + \left \lfloor \frac{y}{7} \right\rfloor=7.$

As $y$ is increased, the next two multiples of $5$ or $7$ are $25$ and $28$. The solution is $$25\le x<28.$$

Is this the sort of practical answer you were looking for?

Summary

The solutions can be completely expressed in terms of how $\frac{abc}{a+b}$ fits between successive terms of the ordered sequence of elements of $aZ\bigcup bZ$.

A formula for the revised question

A formula for the minimal $x$ is obtained as in the above answer and can be expressed as follows.

If $\frac{abc}{a+b}$ is in $aZ\bigcup bZ$ then that is the minimal $x$.

Otherwise $x=$ min$ (a\left \lfloor\frac{bc}{a+b}\right\rfloor+a,b\left \lfloor\frac{ac}{a+b}\right\rfloor+b)$.

Related Question