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?

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

  • 1
    $\begingroup$ 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. $\endgroup$ – Larry Freeman Nov 20 '18 at 17:25
  • $\begingroup$ 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. $\endgroup$ – Ofya Nov 20 '18 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.