# Finding roots of an equation wich involves floor function

I'm trying to solve this equation $$\left \lfloor{x +\frac{1}{100}}\right \rfloor + \left \lfloor{x +\frac{2}{100}}\right \rfloor + ... + \left \lfloor{x +\frac{223}{100}}\right \rfloor = 521$$

I haven't faced until now problems like this one... How can I find $x$? Rather than a specific solution, I'm looking for the intuition to use in order to set up a solution to problems like this one.

• Let $n + i/100 \le x < n + (i+1)/100$ the LHS 223 n + (100 - i) +100 + max (23 - 100 + i, 0). – fleablood Feb 7 '16 at 2:19

First, look at how many terms there are, then think about how each term may contribute to the sum. The target sum is $521$, there are 223 summands, and they are adjacent integers. Since $521/223$ is between $2$ and $3$, some summands must be $2$ and some must be $3$. Then, consider the following case.

If 100 of the summands are $2$ and 100 of the summands are $3$, then 200 of the summands add up to $500$. There are 23 number left, and $21$ more is needed to reach $521$. This is impossible even if all the 23 numbers are $1$. What this tells us is, however, that this is close to the correct solution, so let us stick with 100 copies of $2$.

With 100 of the summands fixed, we are left with 123 summands. The task is to choose the right number of $1$'s and $3$'s that will contribute to the remaining value, which is $321$.

If we pick $n$ summands to be $1$, then $123 - n$ of the summands will be $3$, and their sum will be $n + 3(123 - n) = 369 - 2n$. We want this to equal $321$, so we solve \begin{align} 369 - 2n & = 321 \\ \therefore n & = 24. \end{align}

To find $x$, note that we want $\lfloor x + \frac{24}{100} \rfloor$ to be $1$ and $\lfloor x + \frac{25}{100} \rfloor$ to be $2$. We can pick any $x \in \left[\frac{175}{100}, \frac{176}{100}\right)$.

• Some summands must be 1, don't they? There are 223 summands and at most 100 can be any value... – fleablood Feb 7 '16 at 3:27
• @fleablood Yes. 24 of them must be $1$. – Tunococ Feb 7 '16 at 3:38

Let $n - (i-1)/100 > x \ge n - i/100$

So if $i \le 23$ then $[x + j/100] = n - 1$ for $j \le i$. $[x + j/100] = n$ for $i < j \le 100 + i$. $[x + j/100] = n +1$ for $100 + i < j \le 200 + i$ and $[x + j/100] = n + 2$ for $200 + i < j \le 223$.

So $521 = 223n - i + 100 + (23 - i)2 = 223n + 146 - 3i\implies 375 = 223(2) - 3i \implies i = 43$. Which is impossible. So $i > 23$.

So $[x + j/100] = n - 1$ for $j \le i$. $[x + j/100] = n$ for $i < j \le 100 + i$. $[x + j/100] = n +1$ for $100 + i < j \le 223$

So $521 = 223n - i + 123 -i$ so $398 = 223(2) - 2i$ so $i = 24$ so

$1.75 \le x < 1.76$.

Unless I made a mistake which I probably did. $[x + 1/100]$ to $[x + 24/100]$ = 1. So those add up to 24.

$[x + 25/100]$ to $[x + 124/100] = 2$. So those add up to 200 so 224 running total..

$[x + 125/100]$ to $[x + 223/100] = 3$. So those add up to 297 so 521 total. Phew! No mistake. I usually make some indexing mistake.