Problem

Source: 2022 Israel TST test 10 P1

Tags: combinatorics, TST, Israel



Bilbo, Gandalf, and Nitzan play the following game. First, Nitzan picks a whole number between $1$ and $2^{2022}$ inclusive and reveals it to Bilbo. Bilbo now compiles a string of length $4044$ built from the three letters $a,b,c$. Nitzan looks at the string, chooses one of the three letters $a,b,c$, and removes from the string all instances of the chosen letter. Only then is the string revealed to Gandalf. He must now guess the number Nitzan chose. Can Bilbo and Gandalf work together and come up with a strategy beforehand that will always allow Gandalf to guess Nitzan's number correctly, no matter how he acts?