MathDB
Griphook tries to find the magic code

Source: Azerbaijan NMO 2023. Senior P4

August 24, 2023
combinatoricsAZE SENIOR NATIONAL MO

Problem Statement

To open the magic chest, one needs to say a magic code of length nn consisting of digits 0,1,2,3,4,5,6,7,8,9.0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Each time Griphook tells the chest a code it thinks up, the chest's talkative guardian responds by saying the number of digits in that code that match the magic code. (For example, if the magic code is 04230423 and Griphook says 3442,3442, the chest's talkative guard will say 11). Prove that there exists a number kk such that for any natural number nk,n \geq k, Griphook can find the magic code by checking at most 4n20234n-2023 times, regardless of what the magic code of the box is.