I came across this fun puzzle over at MathOverflow:

A princess inhabits a flight of 17 rooms in a row. Each room has a door to the outside, and there is a door between adjacent rooms. The princess spends each day in a room that is adjacent to the room she was in the day before. One day a prince arrives from far away to woo for the princess. The guardian explains the habits of the princess and also the rules to him: Each day he may knock at an outside door of his choice. If the princess is behind it she will open and in the end marry him. If not, nothing happens, and he gets another chance the next day. Unfortunately his return ticket expires after 30 days. Does he have enough time to conquer the princess?

Give it a thought before reading my suggested strategy below.

.

.

"All will be well if you use your mind for your decisions, and mind only your decisions." Since 2007, I have devoted my life to sharing the joy of game theory and mathematics. MindYourDecisions now has over 1,000 free articles with no ads thanks to community support! Help out and get early access to posts with a pledge on Patreon. .

.



Suggested strategy

I believe this answer works because I have tested it in simulation, but I have not figured out a way to formally prove it (I’m so close and yet so far).

So for fun, I will throw it out to you guys.

I have encoded the answer using rot13 (an example of a Caesar cipher) so the casual reader does not accidentally have the answer spoiled.

Paste this text into rot13.com to read my suggested strategy:

Ba gur svefg qnl, xabpx ba qbbe 2. Gura rnpu qnl gel gur arkg uvturfg qbbe, fb lbh xabpx ba qbbe 3, 4, naq fb ba. Xrrc qbvat guvf hagvy lbh ernpu qbbe 16 ba qnl 15. Ba qnl 16, lbh fubhyq ntnva xabpx ba qbbe 16. Gura xrrc xabpxvat ba gur arkg ybjrfg qbbe, fb lbh xabpx ba qbbef 15, 14, naq fb ba. Vs lbh unir abg sbhaq gur cevaprff lrg, gura ba gur ynfg qnl 30 lbh jvyy or xabpxvat ba qbbe 2 naq jvyy svaq ure gurer.

Does this strategy work? Please share your thoughts and answers in the comments. And bonus points to anyone that uses rot13.com to encode their answers to avoid spoilers 🙂

I should also mention I’m returning from vacation, so please be patient as I approve comments and check email.