# Equation with floor function

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$$

$$a=2xk+k+2x^2+2x$$

$$2x^2+2(k+1)x+k-a=0$$

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