Prove identity composed of floor functions

How to prove: $$\left\lfloor \frac{x+2}{6}\right\rfloor -\left\lfloor \frac{x+3}{6}\right\rfloor +\left\lfloor \frac{x+4}{6}\right\rfloor =\left\lfloor \frac{x}{2}\right\rfloor -\left\lfloor \frac{x}{3}\right\rfloor$$

where $x\in \mathbb{R}$. I think it is problem made by Ramanujan, but do not have the source.

• For next time, make sure to show whether or not you have attempted to solve a problem yourself. – Mr Pie Feb 18 '18 at 13:22

Hint: write $x= 6k+r$ where $o\leq r <6$ and $k\in \mathbb{Z}$. Then we have:

$$\left\lfloor \frac{x+2}{6}\right\rfloor -\left\lfloor \frac{x+3}{6}\right\rfloor +\left\lfloor \frac{x+4}{6}\right\rfloor = k + \underbrace{\left\lfloor \frac{r+2}{6}\right\rfloor -\left\lfloor \frac{r+3}{6}\right\rfloor +\left\lfloor \frac{r+4}{6}\right\rfloor}_{A}$$

and

$$\left\lfloor \frac{x}{2}\right\rfloor -\left\lfloor \frac{x}{3}\right\rfloor = k +\underbrace{\left\lfloor \frac{r}{2}\right\rfloor -\left\lfloor \frac{r}{3}\right\rfloor}_{B}$$

• So we end up with the same identity but instead of "x" we have "r". – azerbajdzan Nov 5 '17 at 18:05
• Yes, and now consider the cases for $r$. If $r>4$ then $A=1-1+1=1$ and $B=2-1=1$, and so on... – Aqua Nov 5 '17 at 18:07
• Or just test for all possible r $0<=r<=5$. I see... – azerbajdzan Nov 5 '17 at 18:09
• No, no, no. Be careful, $r$ is not an integer. – Aqua Nov 5 '17 at 18:09
• I just give an example, now you have to take the other case, $3\leq r\leq 4$... – Aqua Nov 5 '17 at 18:12