# Find the sum of the roots of the floor equation

How to find the sum of the roots of the following floor equation? $$[\frac{x}{2}]+[\frac{x}{3}]+[\frac{x}{5}]=x$$

I found the following solutions by Mathematica:

$\{\{ x= 0\},\{x = 6\},\{x = 10\},\{x= 12\},\{x= 15\}, \{x= 16\}$,

$\{x=18\},\{x =20\}, \{x= 21\}, \{x=22\}, \{x = 24\}, \{x = 25\}$,

$\{x =26\}, \{x= 27\}, \{x= 28\}, \{x= 31\}, \{x=32\}, \{x=33\}$ ,$\{x=34\}, \{x=35\}, \{x= 37\}, \{x=38\}, \{x= 39\}, \{x= 41\}$,$\{x= 43\}, \{x=44\}, \{x=47\}, \{x= 49\}, \{x= 53\}, \{x= 59\}\}$

$Sum=885$

Observe that the solutions occur in pairs that sum to 59: $\{x=a\},\{x=59-a\}$ for various $a$.

Modular arithmetic helps to explain why.

Note that $59\equiv-1\pmod{2,3,5}$

Looking at the modulo 2, 3 and 5 cases: \begin{align} x\equiv b\pmod{2} &\iff 59-x\equiv 1-b\pmod{2} &(0\leq b\leq 1)\\ x\equiv b\pmod{3} &\iff 59-x\equiv 2-b\pmod{3} &(0\leq b\leq 2)\\ x\equiv b\pmod{5} &\iff 59-x\equiv 4-b\pmod{5} &(0\leq b\leq 4) \end{align}

As a result:

\begin{align} \left\lfloor\frac{x}{2}\right\rfloor + \left\lfloor\frac{59-x}{2}\right\rfloor &= \frac{59}{2}-\frac{1}{2} = 29 \\ \left\lfloor\frac{x}{3}\right\rfloor + \left\lfloor\frac{59-x}{3}\right\rfloor &= \frac{59}{3}-\frac{2}{3} = 19 \\ \left\lfloor\frac{x}{5}\right\rfloor + \left\lfloor\frac{59-x}{5}\right\rfloor &= \frac{59}{5}-\frac{4}{5} = 11 \end{align}

So that $$\left\lfloor\frac{x}{2}\right\rfloor + \left\lfloor\frac{x}{3}\right\rfloor + \left\lfloor\frac{x}{5}\right\rfloor + \left\lfloor\frac{59-x}{2}\right\rfloor + \left\lfloor\frac{59-x}{3}\right\rfloor + \left\lfloor\frac{59-x}{5}\right\rfloor = 29+19+11=59$$

Hence, $x$ satisfies the floor equation if and only if $59-x$ does.

Note also that there are no solutions to the floor equation for $x\geq60$, because then \begin{align} \left\lfloor\frac{x}{2}\right\rfloor + \left\lfloor\frac{x}{3}\right\rfloor + \left\lfloor\frac{x}{5}\right\rfloor &\geq \left(\frac{x}{2}-\frac{1}{2}\right) + \left(\frac{x}{3}-\frac{2}{3}\right) + \left(\frac{x}{5}-\frac{4}{5}\right) \\[1em] &= \frac{31}{30}x-\frac{59}{30} = x+\frac{x-59}{30} > x\\ \end{align}

Similarly, there are no solutions for $x<0$.

From the fact that there are 30 solutions (this could be more difficult to establish), the sum is then $$S=\frac{30}{2}\times 59=15\times59=885$$

To find all solutions for $0\le x\le29$, note that if we denote the remainder of $x$ when divided by $p$ as $r_p$, then from the original floor equation: \begin{align} \left(\frac{x}{2}-\frac{r_2}{2}\right) + \left(\frac{x}{3}-\frac{r_3}{3}\right) + \left(\frac{x}{5}-\frac{r_5}{5}\right) &= x &\implies \\[1em] \frac{31}{30}x-\frac{r_2}{2}-\frac{r_3}{3}-\frac{r_5}{5}&=x &\implies \\[1em] x = 15r_2 + 10r_3 + 6r_5 \tag{1} \end{align}

Since many numbers cannot be made up of sums of non-negative multiples of $6,10,15$, it is evident that only numbers inclusively less that 29 that need to be examined are: $\{0,6,10,12,15,16,18,20,21,22,24,25,26,27,28\}$

It turns out that all of these satisfy (1), i.e. the $r_i$ are correct, and hence there are 15 solutions to the floor equation for $0\le x\le29$, so 30 solutions total.