Does $\left\lfloor\frac{x^2+x}{i}\right\rfloor - \left\lfloor\frac{x^2}{i}\right\rfloor = \left\lfloor\frac{x}{i}\right\rfloor$?

Does $$\left\lfloor\dfrac{x^2+x}{i}\right\rfloor - \left\lfloor\dfrac{x^2}{i}\right\rfloor = \left\lfloor\dfrac{x}{i}\right\rfloor$$?

where $$i \le x^2$$ and $$x$$ are any positive integer.

Intuitively, this doesn't seem correct to me but here's my argument which appears valid:

(1) There exists an integer $$a$$ such that: $$x \equiv a \pmod i$$ where $$0 \le a < i$$

(2) $$\left\lfloor\dfrac{x^2+x}{i}\right\rfloor - \left\lfloor\dfrac{x^2}{i}\right\rfloor = \dfrac{x^2 + x - a^2 - a}{i} - \dfrac{x^2 - a^2}{i} = \dfrac{x-a}{i} = \left\lfloor\dfrac{x}{i}\right\rfloor$$

Is my argument wrong? Is my intuition wrong?

• $\left\lfloor \frac{4 + 2}{3} \right\rfloor - \left\lfloor \frac{4}{3} \right\rfloor \neq \left\lfloor \frac{2}{3} \right\rfloor$ – Connor Harris Nov 20 '18 at 16:53
• If $0 \leq a < i$ then you can't conclude that $0 \leq a^2 < i$. – Connor Harris Nov 20 '18 at 16:55
• Nice. So the mistake is the subtraction by $a^2$. Thanks. I suspected it was wrong. – Larry Freeman Nov 20 '18 at 16:56
• So, it is only true when $\left\lfloor\dfrac{a^2+a}{i}\right\rfloor = \left\lfloor\dfrac{a^2}{i}\right\rfloor$? – Larry Freeman Nov 20 '18 at 17:02

Consider x = 7 and i = 5. you get

$$\left\lfloor\dfrac{49+7}{5}\right\rfloor = 11$$

$$\left\lfloor\dfrac{49}{5}\right\rfloor = 9$$

$$\left\lfloor\dfrac{7}{5}\right\rfloor = 1$$

as you see the equation doesn't hold.

Your intuition is right and the argument is wrong. The same argument should follow the following logic

$$\dfrac{x}{i} = k + \dfrac{a}{i}$$ where $$k$$ is highest possible positive integer without making term a negative

$$\dfrac{x^2}{i} = l + \dfrac{a^2}{i}$$

$$\left\lfloor\dfrac{x^2+x}{ i}\right\rfloor = k + l + \left\lfloor\dfrac{a+a^2}{i}\right\rfloor$$

$$\left\lfloor\dfrac{x^2}{i}\right\rfloor = l + \left\lfloor\dfrac{a^2}{i}\right\rfloor$$

$$\left\lfloor\dfrac{x}{i}\right\rfloor = k + \left\lfloor\dfrac{a}{i}\right\rfloor$$

as you see the floor terms are not necessarily equal. There could be cases when $$a+a^2$$ is higher than $$i$$ when both $$a$$ and $$a^2$$ are less than $$i$$.

Hope it helps

• Thanks for your answer. I hope it's ok that I converted your answer to latex. I think that it makes it more readable. Cheers. – Larry Freeman Nov 20 '18 at 17:25
• Thank you very much, I wanted to make it more readable but didn't have much time and didn't want to leave the question unanswered. – Ofya Nov 20 '18 at 20:24