Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
up vote 4 down vote accepted

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.

share|cite|improve this answer
Awesome. Thanks. – Desmond Hume Mar 25 '14 at 14:58
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$. – Sabyasachi 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. – Sabyasachi Mar 25 '14 at 17:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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