MathDB
Magic castle maze

Source: Canada Repêchage 2015/8

June 18, 2016
combinatorics

Problem Statement

A magical castle has nn identical rooms, each of which contains kk doors arranged in a line. In room i,1in1i, 1 \leq i \leq n - 1 there is one door that will take you to room i+1i + 1, and in room nn there is one door that takes you out of the castle. All other doors take you back to room 11. When you go through a door and enter a room, you are unable to tell what room you are entering and you are unable to see which doors you have gone through before. You begin by standing in room 11 and know the values of nn and kk. Determine for which values of nn and kk there exists a strategy that is guaranteed to get you out of the castle and explain the strategy. For such values of nn and kk, exhibit such a strategy and prove that it will work.