How would one solve an equation with a floor function in it:

$$a - (2x + 1)\left\lfloor{\frac {a - 2x(x + 1)}{2x + 1}}\right\rfloor - 2x(x + 1) = 0$$

$a$ is a given and can be treated as a natural number, and all $x$ other than integers can be discarded. At least one non-trivial solution would be sufficient.

Maybe an algorithmic method could be used?


Rearranging we get,

$$\frac{a - 2x(x + 1)}{(2x + 1) } =\left\lfloor{\frac {a - 2x(x + 1)}{2x + 1}}\right\rfloor $$

This means,$\frac{a - 2x(x + 1)}{(2x + 1) }$ is an integer.

$$\frac{a - 2x(x + 1)}{(2x + 1) }=k$$



Applying the quadratic formula,

$$x = \frac{-2(k+1)\pm\sqrt{4(k+1)^2-8(k-a)}}{4}$$

$a$ is known, now we substitute integers in place of $k$ to obtain solutions.

  • $\begingroup$ Awesome. Thanks. $\endgroup$ – Desmond Hume Mar 25 '14 at 14:58
  • $\begingroup$ Oh, one last question. Is there a way to skip those $k$ that don't result in integer $x$? $\endgroup$ – Desmond Hume Mar 25 '14 at 16:27
  • $\begingroup$ @DesmondHume one thing to note would be $k$ has to be odd, so that should significantly lower your false $k$. $\endgroup$ – Guy Mar 25 '14 at 16:50
  • $\begingroup$ So no way to keep $x$ integer? $\endgroup$ – Desmond Hume Mar 25 '14 at 17:02
  • $\begingroup$ @DesmondHume maybe I can improve the analysis if you can give me $a$ before hand. $\endgroup$ – Guy Mar 25 '14 at 17:04

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.