You die, and awake in Hell. Satan awaits you, and has prepared a curious game. On a blackboard, he has written the polynomial $x^2+x+666$. He explains the rule:

On each day at $12$ noon, you must either increase or decrease the coefficient of $x$ by $1$, and a minute after, Satan will either increase or decrease the constant term by $1$. If at some point, the polynomial on the board at that instant has integer roots, you'll be freed from Hell. Satan will of course try his hardest to make sure you never leave.

Is there a strategy that eventually guarantees your salvation? Or can Satan conspire to keep you in Hell forever?


Credits: Puzzle taken from Indian Maths Olympiad, 2014, wording copied from Coin Flipping Game with the Devil.

  • 1
    $\begingroup$ So my strategy is to get integer roots either immediately after my move, or immediately after Satan's move? $\endgroup$ Commented Jul 22, 2016 at 15:32
  • $\begingroup$ @ChrisCudmore If you mean 'goal' instead of 'strategy', then yes. :-) $\endgroup$
    – Ankoganit
    Commented Jul 22, 2016 at 15:34
  • $\begingroup$ @ChrisCudmore After your move. Satan's move is to make the equation not have integer roots. Although it would be interesting if there was a way to trap Satan into making the move that freed you. $\endgroup$ Commented Jul 22, 2016 at 15:39
  • $\begingroup$ I'm confused. Which is the correct interpretation? 1. To go free, the polynomial must have an integer root immediately after you change the coefficient. 2. To go free, the polynomial must have an integer root immediately after Satan changes the constant. 3. To go free, the polynomial must have an integer root at any point in time, regardless of who last changed something. Poolsharker's comment suggests it's #1, but Ankoganit's comment seems to indicate #3 (assuming "then yes" means "then, yes, either one of those") but the original text suggests #2 to me. $\endgroup$
    – Kevin
    Commented Jul 22, 2016 at 16:00
  • 1
    $\begingroup$ @Kevin By the wording in the OP, "If at some point..." your #3 is the correct interpretation. I missed that when I made my comment and only noticed when I re-read it. My point was that Satan would make a move to avoid such a situation if possible. Sorry for the confusion. $\endgroup$ Commented Jul 22, 2016 at 16:07

1 Answer 1


It is always possible for you to force the polynomial to have the root $-2$:

$$ x^2 + (a+2) x + 2a = (x+2)(x+a)$$

Your strategy is to increase your term until it is slightly higher than half the third term. If Satan ever decreases the third term, then that makes it easier for you. So to prolong as long as possible, he would always increase the third term.

On the $666^{th}$ day, you change the formula to:

$$ x^2 + 667 x + 1331$$

If Satan chooses to decrease, then you have

$$ x^2 + 667x + 1330 = (x+2)(x+665)$$

so he must increase, yielding:

$$ x^2 + 667x + 1332$$

On day 667, you increase again, yielding:

$$ x^2 + 668x + 1332 = (x+2)(x+666)$$

Again, if Satan ever decreases, then you win that much sooner.

Aside: I have not checked whether if you both pursue the above strategy whether you would already have won some days earlier, but it is possible. If that were the case, Satan would have needed to decrease at least once to prevent that win, and you would have won a bit earlier. The question didn't ask for optimal solution, just proof that you could win.

Update For those curious whether you would have already won before day 666 by the above strategy, on day 57, you would change the formula to:

$$x^2 + 58x + 722 = (x+19)(x+38)$$

and you win. (Note: $666 = 18\times37$, not a coincidence). Thus, on day 56, Satan has to decrease.

  • 2
    $\begingroup$ $2\times 666=1332\ne 1232$. Other than that it looks OK. $\endgroup$
    – Ankoganit
    Commented Jul 22, 2016 at 16:33
  • 6
    $\begingroup$ Actually, on day 54, after you increase the linear term to 55, Satan won't respond by increasing the constant to 720, because then on day 55 you can make the linear term 56, and then the roots are -36, -20.. $\endgroup$
    – Rosie F
    Commented Jul 22, 2016 at 17:36
  • 1
    $\begingroup$ @Wen1now you now have three sixes in your reputation... $\endgroup$
    – Mr Pie
    Commented Aug 27, 2018 at 10:25
  • $\begingroup$ @RosieF It appears that the Devil's longest games against this strategy last $647$ days, and end at either $x^2+646x+1288$ or $x^2+648x+1292$, depending on whether the Devil tries to "thread the needle" and move to $x^2+646x+1289$ or not. $720$ poses quite the formidable roadblock, forcing five decreases. $\endgroup$ Commented Nov 15, 2021 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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