Maths Olympiad Prep

Library / /265 of 397

Number theory Difficulty 6.3 National Olympiad Prove it Taiwan

Let pp be a prime. In the following game, Ed and Alfie take turns to play, each taking his own turn. On a person's turn, he first chooses an ii from {0,1,,p1}\{0, 1, \dots, p-1\} that has not yet been chosen by either side, and then chooses an element aia_i from {0,1,2,,9}\{0, 1, 2, \dots, 9\}. Ed goes first. Once all of {0,1,,p1}\{0, 1, \dots, p-1\} have been chosen, the game ends and the following number is computed
M=a0+10×a1++10p1×ap1=j=0p1aj×10j. M = a_0 + 10 \times a_1 + \cdots + 10^{p-1} \times a_{p-1} = \sum_{j=0}^{p-1} a_j \times 10^j.
If MM is divisible by pp, Ed wins; otherwise, Alfie wins.
Prove that Ed has a winning strategy.

Solution

We say that a player makes the move (i,ai)(i, a_i) if he chooses the index ii and then the element aia_i of the {0,1,,9}\{0, 1, \dots, 9\} in this move.

(1) If p=2p=2 or p=5p=5, then the first player simply chooses (0,0)(0, 0), which forces 10M10|M, which guarantees he wins.

(2) So assume p{2,5}p \notin \{2, 5\}. Let the first player choose (p1,0)(p-1, 0) in the first move. By Fermat's Little Theorem, (10(p1)/2)2=10p11(modp)(10^{(p-1)/2})^2 = 10^{p-1} \equiv 1 \pmod p, so p(10(p1)/2)21=(10(p1)/21)(10(p1)/2+1)p|(10^{(p-1)/2})^2 - 1 = (10^{(p-1)/2} - 1)(10^{(p-1)/2} + 1). Since pp is prime, we are left with two cases:

(i) p10(p1)/21p|10^{(p-1)/2} - 1

In this case, for each move (i,ai)(i, a_i) made by the second player, the first player immediately makes a move
(j,aj)={(i+p12,ai),0ip32;(ip12,ai),p12ip2. (j, a_j) = \begin{cases} (i + \frac{p-1}{2}, a_i), & 0 \le i \le \frac{p-3}{2}; \\ (i - \frac{p-1}{2}, a_i), & \frac{p-1}{2} \le i \le p-2. \end{cases}

This makes the sum be divisible by pp, thus wins the game. One can easily check that this move is always possible.

(ii) p10(p1)2+1p|10^{\frac{(p-1)}{2}} + 1

In this case, for each move (i,ai)(i, a_i) made by the second player, the first player immediately makes a move
(j,aj)={(i+p12,9ai),0ip32(ip12,9ai),p12ip2. (j, a_j) = \begin{cases} (i + \frac{p-1}{2}, 9 - a_i), & 0 \le i \le \frac{p-3}{2} \\ (i - \frac{p-1}{2}, 9 - a_i), & \frac{p-1}{2} \le i \le p-2. \end{cases}

In any case, we will have 10j10i(modp)10^j \equiv 10^i \pmod p, and hence, aj10j+ai10i(aj+ai)10i=9×10i(modp)a_j 10^j + a_i 10^i \equiv (a_j + a_i) 10^i = 9 \times 10^i \pmod p. Therefore, at the end of the game, MM would be congruent to
i=0(p3)/29×10i=10(p1)210(modp). \sum_{i=0}^{(p-3)/2} 9 \times 10^i = 10^{\frac{(p-1)}{2}} - 1 \equiv 0 \pmod{p}.
This ensures that the first player wins. Again, one can easily check that this move is always possible.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement translated into English from zh; metadata (topic, difficulty) added by this project.