MathDB
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 1x220221\leq x\leq 2^{2022} and shows it to Bilbo. Now bilbo writes on the board a long row of NN digits, each of which is 00 or 11. 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 xx.
Can Bilbo and Gandalf come up with a strategy that allows Gandalf to guess xx correctly no matter how Nitzan acts, if a) N=2500N=2500? b) N=2030N=2030? c) N=2040N=2040?