Gandalf and Bilbo guessing game
Source: 2022 Israel National Olympiad P7
December 16, 2022
combinatoricsInfo
Problem Statement
Gandalf (the wizard) and Bilbo (the assistant) are presenting a magic trick to Nitzan (the audience). While Gandalf leaves the room, Nitzan chooses a number and shows it to Bilbo. Now bilbo writes on the board a long row of digits, each of which is or . After this Nitzan can, if he wishes, switch the order of two consecutive digits in the row, but only once. Then Gandalf returns to the room, looks at the row, and guesses the number .Can Bilbo and Gandalf come up with a strategy that allows Gandalf to guess correctly no matter how Nitzan acts, if
a) ?
b) ?
c) ?