# Polynomial game with Devil

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.

• So my strategy is to get integer roots either immediately after my move, or immediately after Satan's move? – Chris Cudmore Jul 22 '16 at 15:32
• @ChrisCudmore If you mean 'goal' instead of 'strategy', then yes. :-) – Ankoganit Jul 22 '16 at 15:34
• @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. – Poolsharker Jul 22 '16 at 15:39
• 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. – Kevin Jul 22 '16 at 16:00
• @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. – Poolsharker Jul 22 '16 at 16:07

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\times 666=1332\ne 1232$. Other than that it looks OK. – Ankoganit Jul 22 '16 at 16:33
• 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.. – Rosie F Jul 22 '16 at 17:36
• @Wen1now you now have three sixes in your reputation... – Mr Pie Aug 27 '18 at 10:25