Let $ p \geq 2$ be a prime number. Eduardo and Fernando play the following game making moves alternately: in each move, the current player chooses an index $i$ in the set $\{0,1,2,\ldots, p-1 \}$ that was not chosen before by either of the two players and then chooses an element $a_i$ from the set $\{0,1,2,3,4,5,6,7,8,9\}$. Eduardo has the first move. The game ends after all the indices have been chosen .Then the following number is computed: $$M=a_0+a_110+a_210^2+\cdots+a_{p-1}10^{p-1}= \sum_{i=0}^{p-1}a_i.10^i$$. The goal of Eduardo is to make $M$ divisible by $p$, and the goal of Fernando is to prevent this. Prove that Eduardo has a winning strategy. Proposed by Amine Natik, Morocco
Problem
Source: IMO shortlist , N2
Tags: number theory, IMO Shortlist, game
10.07.2018 14:09
Note : In Thailand TST, Eduardo and Fernando are replaced with Alice and Bob respectively.
10.07.2018 14:12
If $p \in \{2, 5\}$ Eduardo simply sets $a_0 = 0$ and wins. Now suppose $\gcd(p, 10) = 1$. As before, Eduardo sets $a_0 = 0$; he pairs the indices like $(1, \tfrac{p-1}{2} + 1), \dots, (\tfrac{p-1}{2}, p-1)$. Note $10^{p-1} \equiv 1 \pmod{p}$, so $10^{(p-1)/2} \equiv \pm 1 \pmod{p}$. If $10^{(p-1)/2} \equiv +1 \pmod{p}$, when Fernando plays $d$, Eduardo plays $9-d$ in the corresponding position. If $10^{(p-1)/2} \equiv -1 \pmod{p}$, when Fernando plays $d$, Eduardo plays $d$ in the corresponding position. In both cases it is easy to see that the final number is a multiple of $p$.
10.07.2018 14:18
Cute problem, I'm a bit sad that N1 was chosen over this one for IMO1 If $p = 2$ or $p = 5$ then Eduardo wins immediately by choosing $a_0 = 0$. In what follows, $p$ is some other prime. Eduardo first chooses $a_{p - 1} = 0$. For brevity, let $f(n) = n + \frac{p - 1}{2}$ if $n < \frac{p - 1}{2}$ and $f(n) = n - \frac{p - 1}{2}$ otherwise. Clearly $f(f(n)) = n$ for all $0 \leq n \leq p - 2$. Now assume that Fernando chooses to play $a_i = d$ for some digit $d$. Then Eduardo will choose to set the value of $a_{f(i)}$. Notice that $10^{\frac{p - 1}{2}}$ is $1$ or $-1$ depending on whether $10$ is a quadratic residue $\bmod{p}$. If this number is congruent to $-1$ then Eduardo chooses $a_{f(i)} = d$. Otherwise, he chooses $a_{f(i)} = 9 - d$. In either case this play guarantees that $10^ia_i + 10^{f(i)}a_{f(i)}$ is a multiple of $p$, and so the sum is a multiple of $p$ after each of Eduardo's plays, meaning that he wins, as there are an even number of choices left after his first play due to $p$ being odd.
10.07.2018 14:20
Me too , this problem is fantastic , i don't know why it wasn't selected
10.07.2018 15:28
The first player can always win. Assume first $\gcd(p,10) = 1$, and let $e$ be the order of $10 \pmod p$. First player begins by choosing $a_{p-1} = 0$. Now let $p-1 = de$. We consider two cases: If $e$ is even, then $10^{e/2} \equiv -1 \pmod p$. First player imagines pairing the indices $\{0, 1, \dots, p-2\}$ into pairs which differ by $e/2$ in the obvious way (there are $d$ pairs of $2$ each). Now whenever second player picks a number $a_i$ , first player selects the corresponding index $j$ and sets $a_j = a_i$. As $10^j a_j + 10^i a_i \equiv 0 \pmod p$ this strategy wins. If $e$ is odd, then $d$ must be even. First player imagines pairing the indices $\{0, 1, \dots, p-2\}$ into pairs which differ by $e$ in the obvious way (there are $d/2$ pairs of $2$ each). Now whenever second player picks a number $a_i$ First player selects the corresponding index $j$ and sets $a_j = 9 - a_i$. Thus $10^j a_j + 10^i a_i \equiv 9 \cdot 10^i \pmod p$. So the final number is a multiple of $9\dots9 = 10^e-1$ which is divisible by $p$. If $p=2$ or $p=5$, first player just picks $a_0 = 0$ and wins. Thus second player has the winning strategy. Remark: One can phrase this solution without the use of orders $d$ and $e$; it's merely casework on the value of $10^{\frac{1}{2}(p-1)}$.
12.07.2018 14:15
Well my solution is much similar to Cantonmathguy but i am posting it. If $p=(2,5)$, Eduardo first sets $a_0=0$ and thus he would have a winning strategy. Now $\boxed{gcd(p,10)=1}$ So $10^{\frac{p-1}{2}}\equiv \pm 1\pmod{p}$ We would be dealing with two cases. Case:1 $10^{\frac{p-1}{2}}\equiv - 1\pmod{p}$ First we consider two sets $F$ and $K$, $F=(10,10^2\cdots 10^{\frac{p-1}{2}})$ $K=(10^{\frac{p-1}{2}+1}\cdots 10^{p-1})$
First Eduardo must set $a_0=0$, then whatever element Fernando chooses with index as exponent of one of the elements of set F or M, Eduardo must choose must choose the element with corresponding index from the different set such that above claim holds true. Thus Eduardo has a winning strategy. Case:2 $10^{\frac{p-1}{2}}\equiv 1\pmod{p}$ First Eduardo again must set $a_0=0$ Now for whatever element $a_i$ Fernando chooses,Eduardo must choose an element $9-a_i$ from another set with the corresponding index such that 10 raised to both indices are congruent modulo p. If he does that then , $M=(a_110+a_{\frac{p-1}{2}+1}10^{\frac{p-1}{2}+1})+\cdots (a_{\frac{p-1}{2}}10^{\frac{p-1}{2}}+a_{p-1}10^{p-1})$
$\implies M\equiv 9(10+10^2+\cdots 10^{\frac{p-1}{2}})=9(10(\frac{10^{\frac{p-1}{2}}-1}{9}))\equiv 0\pmod{p}$ Hence again Eduardo has a winning strategy.
20.08.2018 09:44
22.08.2018 09:17
This problem is really quite cute. (Note: After reading other's solutions, mine is a bit more complicated than it could be, but its close enough ) Note that Eduardo is being referred to as you, and Fernando is being referred to as they. If $p\in\{2,5\}$, simply set $a_0=0$ for the win. Suppose the order of $10$ mod $p$ is $\frac{p-1}{k}$ where obviously $k\mid p-1$. Let $\ell=\frac{p-1}{k}$. Note that $10^0,10^1,\ldots,10^{p-2}$ is the same as $10^0,10^1,\ldots,10^{\ell-1}$, repeated $k$ times. Now, start by setting $a_{p-1}=0$. There are two cases. Case 1: $k$ is even Pair index $i$ with $i+\ell$ if $\lfloor i/\ell\rfloor$ is even, and pair $i$ with $i-\ell$ if $\lfloor i/\ell\rfloor$ is odd (note that $a$ is paired with $b$ if and only if $b$ is paired with $a$). The fact that $k$ is even gives every index from $0,\ldots,p-2$ a unique pair. Note that $10^a\equiv 10^b\pmod{p}$ if $a$ and $b$ are paired. Therefore, if they choose $a_i$, you simply choose $a_j=9-a_i$ where $j$ is paired to $i$. This causes the entire sum to be a multiple of $9(10^0+\cdots+10^{\ell-1})=10^\ell-1=0$ where all equalities are mod $p$, so the sum is divisible by $p$ and you win! Case 2: $k$ is odd Now, we see that $\ell$ is even, so $10^{\ell/2}\equiv -1\pmod{p}$ (it has to be $\pm 1$ since its square is $1$, and it can't be $1$ by definition of order). Therefore, in each cluster of indices $n\ell+0,n\ell+1,\cdots,n\ell+(\ell-1)$, pair up opposite indices, i.e. $n\ell+i$ with $n\ell+(\ell-1-i)$. We now see that if $a$ and $b$ are paired, then $10^a\equiv -10^b\pmod{p}$, so if they choose $a_i$, you simply choose $a_j=a_i$ where $j$ is paired to $i$. This causes the entire sum to be $0$ mod $p$, as desired, so you win in this case too! Therefore, you can always win.
08.10.2019 12:37
Suppose $p$ divides $10$. Then Eduardo can choose $a_0=0$ hence winning. So suppose $p$ is not a factor of $10$ and thus $p$ is odd, and is coprime to $10$. Suppose $10$ is not a quadratic residue modulo $p$. So we have $p|10^k+1$ where $k=\frac{p-1}{2}$. Now group the numbers as follows: $(0,k),(1,k+1),..(k-1,2k-1)$ so the only number from $0$ to $p-1$ not in a group is $2k=p-1$. Here is what Eduardo does: First he makes $a_{p-1}=0$. Suppose Fernando makes $a_j=l$ at a step for some $j$. Eduardo takes $j'$, the second member of $j$s group and makes $a_{j'}=l$, and does this at each turn. We can see that the final number produced is a multiple of $10^k+1$ so it is a multiple of $p$ thus Eduardo wins. If $10$ is a quadratic residue modulo $p$, then we can see that $p|10^k-1$. Keep the same groups as the previous case. Eduardo makes $a_{p-1}=0$ and this time, if at any step Fernando makes $a_j=l$ then Eduardo makes $a_{j'}=9-l$, with the same definition of $j'$ as earlier. Because $p|10^k-1$, the entire sum at the end is congruent to $9(1+10+10^2+...10^{k-1})=(10-1)(1+10+10^2+...10^{k-1})=10^k-1 \equiv 0$ mod $p$, thus Eduardo can always win. Proved. Edit: Similar to CantonMathGuy's solution.
19.02.2020 14:31
2017 N2 wrote: Eduardo and Fernando play the following game making moves alternately: in each move, the current player chooses an index $i$ in the set $\{1,2,\ldots, p-1 \}$ that was not chosen before by either of the two players Shouldn't the set be \(\{0,1,2,\ldots,p-1\}\)? I realised this after trying the problem (without knowing this) for 2 hours...
27.02.2020 08:47
aops29 wrote: 2017 N2 wrote: Eduardo and Fernando play the following game making moves alternately: in each move, the current player chooses an index $i$ in the set $\{1,2,\ldots, p-1 \}$ that was not chosen before by either of the two players Shouldn't the set be \(\{0,1,2,\ldots,p-1\}\)? I realised this after trying the problem (without knowing this) for 2 hours... Yes I think so too.
27.05.2020 19:12
Similar to other solutions, maybe too detailed. Oh well... If $p=2$ or $p=5$, then Eduardo can simply choose $a_0=0$. So assume $\gcd(10,p)=1$. First note that $p|10^{p-1}-1=(10^{\frac{p-1}{2}}-1)(10^{\frac{p-1}{2}}+1)$, so $10^{\frac{p-1}{2}}\equiv \pm 1\pmod{p}$. Here is the case-based strategy for Eduardo: CASE 1: $10^{\frac{p-1}{2}}\equiv -1\pmod{p}$ $\bullet$ Eduardo first chooses $a_0=0$. $\bullet$ For any index $i$ and number $a_i$ that Fernando chooses, if $i\leq \frac{p-1}{2}$, then Eduardo chooses index $j=i+\frac{p-1}{2}$ and lets $a_j=a_i$. If $i>\frac{p-1}{2}$, then Eduardo chooses index $j=i-\frac{p-1}{2}$, and lets $a_j=a_i$. Note that since $p-1$ is even, so Eduardo will make the last choice. Also note that each index is chosen only once. Now this strategy works since for each choice of $i,j,a_i,a_j$ as in the above algorithm, we have $a_i=a_j=a$ (say) and $a_i10^i+a_j10^j\equiv a(10^i+10^{i\pm \frac{p-1}{2}})\equiv a10^i(1+10^{\pm\frac{p-1}{2}})\equiv 0\pmod p$. So $M\equiv 0\pmod p$ and thus Eduardo wins. $\square$ CASE 2: $10^{\frac{p-1}{2}}\equiv 1\pmod{p}$ $\bullet$ Eduardo starts with choosing $a_0=0$. $\bullet$ For any index $i$ and number $a_i$ that Fernando chooses, if $i\leq \frac{p-1}{2}$, then Eduardo chooses index $j=i+\frac{p-1}{2}$ and lets $a_j=9-a_i$. If $i>\frac{p-1}{2}$, then Eduardo chooses index $j=i-\frac{p-1}{2}$, and lets $a_j=9-a_i$. So for each choice of $i,j,a_i,a_j$ in the above strategy, we have $a_i10^i+a_j10^j\equiv a_i(10^i-10^j)+9\cdot 10^j\equiv a_i10^i(1-10^{\pm\frac{p-1}{2}})+9\cdot 10^j\equiv 9\cdot 10^j\pmod p $. Now let $i_1,i_2,\dots, i_{\frac{p-1}{2}}$ be the indices chosen by Eduardo in that order apart from $0$, and let $j_1,j_2,\dots, j_{\frac{p-1}{2}}$ be the indices chosen by Fernando in that order. Note that $i_k=j_k\pm \frac{p-1}{2}$. Thus we have $M\equiv 9(10^{i_1}+\dots+10^{i_\frac{p-1}{2}})\equiv 9(10^{j_1}+\dots+10^{j_\frac{p-1}{2}})\equiv \frac{9(10+10^2+\dots+10^{p-1})}{2}\equiv 5(10^{p-1}-1)\equiv 0\pmod p$. Thus Eduardo wins again. $\square$ So Eduardo does have a winning strategy. $\blacksquare$
10.07.2020 00:56
Great problem! Call the players A and B, and let $m=\text{ord}_{10}p.$ We can easily check that $A$ wins for $p=2,3,5,7,$ so assume $p>10.$ $\textbf{Case 1: }$ $m$ is even Then, we must have $10^{m/2}\equiv -1\pmod{p},$ so $10^{k}+10^{k+m/}\equiv 0\pmod{p}$ for all $k.$ Now suppose A starts by setting $a_0$ to $0.$ At any later turn, if $B$ sets $a_i=d$ for some $d,$ then $A$ can set $a_{i+m/2}=d$ (where indices are taken modulo $p-1$) to ensure that the resulting number is divisible by $p.$ Thus, $A$ can force $p\mid N$ in this case. $\textbf{Case 2: }$ $m$ is odd. Then, since $p-1$ is even, there are an even number of terms in each of the following sets: $$\{a_1,a_{1+m},\dots,a_{p-m}\},$$$$\{a_2,a_{2+m},\dots,a_{p-m+1}\},$$$$\vdots$$$$\{a_{m},a_{2m},\dots,a_{p-1}\}.$$Now suppose $A$ starts by setting $a_0=0,$ and follows the following strategy: if $B$ sets $a_i=d$ for some digit $d,$ then A sets any remaining member of the set that $a_i$ is in to $9-d.$ This process causes the remainder when the resulting number is divided by $p$ to be $$9\left(\frac{p-1}{2m}\right)(10^0+10^1+\dots+10^{m-1})\equiv 0\pmod{p},$$as desired. EDIT: This is basically @MarkBcc's solution
26.07.2020 23:59
Basically the same as CantonMathGuy's solution$,$ but decided to post it anyways$.$ Eduardo plays $a_0=0.$ If $p\in \{2, 5\},$ he obviously wins regardless of his next choices$.$ Case 1: $\left( \frac{10}{p} \right)=-1$ Denote $A=\{1, 2, \cdots \frac{p-1}{2}\}, B=\{\frac{p+1}{2}, \cdots, p-1\}.$ Whenever Fernando choses some $a_i,$ Eduardo has to chose $a_{i+\frac{p-1}{2}}=a_i$ or $a_{i-\frac{p-1}{2}}=a_i$ with regard to $i$ being in $A$ or $B.$ Note that Eduardo can always do this$,$ since he already selected $a_0=0$ and there is a bijection $f:A\rightarrow B$ given by $f(x)=x+\frac{p-1}{2},$ thus he always choses $f(i)$ or $f^{-1}(i)$ and puts the digit from Fernando's turn$.$ We see that after every pair of turns$,$ starting with Fernando$,$ the sum remains unchanged modulo $p,$ therefore at the end it will be congruent to $a_0=0 \pmod p.$ Case 1: $\left( \frac{10}{p} \right)=1$ Starting from the second turn of the game$,$ after Fernando has put $a_i,$ Eduardo choses position $f(i)$ or $f^{-1}(i)$ as before and puts the digit $9-a_i.$ In the end$,$ we see that each pair $(i, f(i)), i\in A$ contributes $9\cdot 10^i$ to the sum$,$ therefore the sum is congruent to $$9\cdot 10+\cdots +9\cdot 10^{\frac{p-1}{2}}=10\cdot(10^{\frac{p-1}{2}}-1)\equiv 0 \pmod p,$$as desired$.$
31.08.2020 23:51
If $p = 2$, Eduardo has to make $a_0 + 10_a1$ a multiple of 2, he can just make $a_0 = 0$ for his first move. If $p = 5$, Eduardo has to make $a_0 + 10a_1 + ... + 10^4a_4$ a multiple of 5, again, Eduardo sets $a_0 = 0$ and he's done. Now we can suppose $gcd(p, 10) = 1$, let $g = ord_p(10)$, we have 2 cases: In beforehand, Eduardo sets $a_0 = 0$ as he starts the game. First Case: $g$ is odd. Split $10^1, 10^2, ..., 10^{p-1}$ into $\frac{p-1}{g}$ groups: $10^{gk+1}, ..., 10^{gk+g}$ if Fernando chooses $a_{gk+r} = d$ then Eduardo chooses $a_{gl+r} = 9-d$, notice that since there's an even amount of groups, Eduardo can choose such $l$. Hence, $M \equiv \frac{p-1}{g}\sum_{i = 1}^{g}((9-d)+d).10^i \equiv \frac{p-1}{g}.(10+10^2+...+10^g).9 \equiv \frac{p-1}{g}.10.\frac{10^g-1}{9}.9 \pmod p$ since $g|p-1$ and $10^g \equiv 1 \pmod p$ we have $M \equiv 10^g-1 \equiv 0 \pmod p$, thus Eduardo wins. Second Case: $g$ is even. Let $h = \frac{g}{2} \Rightarrow p \mid ((10^h)^2-1) \Rightarrow p$ divides either $((10^h)-1)$ or $((10^h)+1)$, if $p \mid ((10^h)-1)$ then $h < g$ satisfying $10^h \equiv 1 \pmod p$ Contradiction. So, $10^h \equiv -1 \pmod p$, define $x_r$ for all $r \in \{0, 1, ..., g-1\}$ the following way: If $r < h \Rightarrow x_r = r+h$. If $r \geq h \Rightarrow x_r = r-h$, then by definition $10^{x_r} \equiv -10^r \pmod p$, therefore if Fernando chooses $a_{gk+r} = d$, Eduardo chooses $a_{gk+x_r} = d$, note that $a_{gk+x_r}$ is already chosen if Fernando chose $a_{gk+x_r}$ or $a_{gk+r}$ earlier, the 1st case yields Eduardo chose $a_{gk+r}$, which is a contradiction, and the 2nd case is clearly untrue, so after Fernando plays, Eduardo can always make $M$ a multiple of $p$, therefore $p \mid M$. Thus, Eduardo has a winning strategy.
12.02.2021 18:42
If $p=2$ or $p=5$, then Eduardo can win simply by choosing $a_0=0$. Now suppose that $p$ and $10$ are coprime. Let $n=\mathrm{ord}_p (10)$. We take cases on the parity of $n$. Case 1: $n$ is even. Then we can see that $10^{n/2} \equiv -1 \pmod{p}$. We can separate $\{a_1,a_2,\ldots,a_{p-1}\}$ into pairs in the form $\{a_{k},a_{k+n/2}\}$ for integer $k$. Notice that: $$10^k+10^{k+n/2} \equiv 10^k-10^k \equiv 0 \pmod{p}$$Thus, Eduardo can first pick $a_0=0$. Then, whenever Fernando picks an index and a digit, Eduardo picks the other index in its pair and the same digit. If we let the digit chosen be $d$, the increase in the value of the sum is given by $d(10^k+10^{k+n/2})$, which is clearly congruent to $0 \pmod{p}$. Thus Eduardo can always keep the sum divisible by $p$, so he has a winning strategy here. Case 2: $n$ is odd. Then we can separate $\{a_1,a_2,\ldots,a_{p-1}\}$ into $n$ sets $S_1,S_2,\ldots,S_n$ defined as: $$S_k=\{a_k,a_{n+k},a_{2n+k},\ldots,a_{p-1-n+k}\}$$which clearly creates disjoint sets whose union is $\{a_1,a_2,\ldots,a_{p-1}\}$. Also note that since $p-1$ is even and $n$ is odd, we must have $|S_k|$ even for all $k$. Eduardo can win here with the following strategy: set $a_0=0$ on the first move. Then when Fernando sets $a_i=d$ for a digit $d$, Eduardo can pick an element which has not yet been chosen (always possible since the size of the set is even) in the same set as $a_i$ and set it equal to $9-d$. When this process is done, we can pair up the elements in each $S_k$ such that their sum is equal to $9$. This produces $\tfrac{p-1}{n}$ pairs, so the sum of the elements in each set is congruent to to: $$\frac{9\cdot 10^k(p-1)}{n} \pmod{p}$$The value of $M$ is equal to the sum of all of the $S_k$ plus $a_0=0$, so we have: $$M \equiv \sum_{k=1}^n \frac{9\cdot 10^k(p-1)}{n} \equiv \frac{9(p-1)}{n} \sum_{k=1}^n 10^k\equiv \left(\frac{9(p-1)}{n}\right) \left(\frac{10(10^n-1)}{9}\right) \equiv 0 \pmod{p}$$where we use the geometric series formula to get the third congruence and the fact that $10^n \equiv 1 \pmod{p}$ to get the fourth congruence. Thus Eduardo can force the sum to be divisible by $p$. Combining these cases implies that Eduardo can always win. $\blacksquare$
14.02.2021 06:53
Solved with nprime06 Rename Eduardo and Fernando to player 1 and player 2 respectively. Player 1 wins for all primes $p$. If $p = 2$ or $5$ then player 1 can set $a_0 = 0$, so suppose $p > 5$. Player 1's Strategy: Notice that $10^{\frac{p-1}{2}}$ is $1$ or $-1$ mod $p$ depending on the prime (by fermat's little theorem). Case 1: $10^{\frac{p-1}{2}} = -1 \pmod p$ Player $1$ can first place $0$ in the first digit. Then in his subsequent turns, if his opponent placed the number $x$ before him in the $y$th digit from the left, then he can place the digit $x$ in the $\left(y\pm \tfrac{p-1}{2}\right)$th digit from the left. This strategy works since: \[x\cdot 10^{y} + x \cdot 10^{y\pm\tfrac{p-1}{2}} \equiv x\cdot 10^{y} - x \cdot 10^{y} \equiv 0 \pmod{p}\] Case 2: $10^{\frac{p-1}{2}} = 1 \pmod p$ Identically to the first case, player 1 can place $0$ in the units digit. Next, on each of his subsequent turns, if his opponent placed the number $x$ before him in the $y$th digit, then he can play $(10-x)$ in the $\left(y\pm \tfrac{p-1}{2}\right)$th digit from the left. (However, if the opponent played a 0, then player 1 can place a 0 in the $\left(y\pm \tfrac{p-1}{2}\right)$th digit from the left) This strategy works because: \[10^1+\cdots+10^{\tfrac{p-1}{2}} = 10(1+\cdots+10^{\frac{p-3}{2}}) = 10\left(\frac{10^{\frac{p-1}{2}}-1}{9}\right) \equiv 0 \pmod p\]
26.06.2021 02:59
We claim Eduardo always wins. For $p=2,5$ Eduardo sets $a_0 = 0$ and gg. Let $e$ denote the order of $10\pmod p.$ Claim: If $e$ is even, then Eduardo wins. Proof. On move one have Eduardo set $a_0 = 0.$ Note that we may partition the terms into pairs of the form $(a_k\cdot 10^k, a_{k+e/2}\cdot 10^{k+e/2}).$ If Fernando ever sets $a_k = a,$ then note that Eduardo can copy Fernando and assign $a_{k+e/2} = a,$ $$a\cdot 10^k + a\cdot 10^{k+e/2} \equiv a\cdot 10^k - a\cdot 10^k \equiv 0 \pmod p$$Whence since Fernando must assign a digit in this set of $(p-1)/2$ pairs first, Eduardo wins. $\blacksquare$ Claim: If $e$ is odd, Eduardo wins. Proof. On move one, have Eduardo assign $a_0 = 0.$ Let $n = (p-1)/e.$ Observe that $n$ is even. Suppose for a given $0\le r <e,$ let $S_r$ denote the set of all $a_i$ with $10^i \equiv 10^r \pmod p.$ Whenever Fernando assigns $a_i,$ let Eduardo assign $a_{n+1-i} = 9 - a_i.$ Then, $$M = \frac{9n}{2}\left(\sum_{i=0}^{e-1} 10^i\right) = \frac{n(10^e-1)}{2} \equiv 0 \pmod p,$$Whence Eduardo wins again. $\blacksquare$
30.08.2021 15:29
Let Eduardo be A and Fernando be B. If $p=2$ or $p=5$, A chooses $a_0=0$ and wins. For $p>5$ let's solve $2$ cases. Case 1: $\left(\frac{10}{p}\right)=-1$ First A chooses $i=a_i=0$. Then the game will contunie as B,A,B,A,...,B,A. $\bullet$ If B chooses $i\leq \frac{p-1}{2}$, then A chooses $j=\frac{p-1}{2}+i$ and $a_j=a_i$. Then $T=a_i\cdot 10^i+a_i\cdot 10^{\frac{p-1}{2}+i}=a_i\cdot 10^i\cdot (10^{\frac{p-1}{2}}+1)$. Since $\left(\frac{10}{p}\right)=-1$, from Euler's criterion $p| 10^{\frac{p-1}{2}}+1$. So $p|T$ $\bullet$ If B chooses $i=\frac{p-1}{2}+i'$, then A chooses $j=i'$ and $a_j=a_i$. Similarly we get $p|a_i\cdot 10^i+a_j\cdot 10^j$ So $a_0+\cdots a_{p-1}10^{p-1}$ is divisiblee by $p$ and A wins. Case 2: $\left(\frac{10}{p}\right)=1$ Again first A chooses $i=a_i=0$ and the game will contunie as B,A,B,A,...,B,A. $\bullet$ If B chooses $i\leq \frac{p-1}{2}$, then A chooses $j=\frac{p-1}{2}+i$ and $a_j=9-a_i$. Then $N=a_i\cdot 10^i+a_j\cdot 10^j=a_i\cdot 10^i\cdot (1-10^{\frac{p-1}{2}})+9\cdot 10^{\frac{p-1}{2}+i}$. Again from Euler's criterion $10^{\frac{p-1}{2}}\equiv 1\ (mod \ p)$ and $N\equiv 9\cdot 10^{i}(mod \ p)$ $\bullet$ If B chooses $i=\frac{p-1}{2}+i'$, then A chooses $j=i'$ and $a_j=9-a_i$. Similarly we get $a_i\cdot 10^i+a_j\cdot 10^j\equiv 9\cdot 10^{i'}(mod \ p)$ Note that choosing B $"i"$ or $"\frac{p-1}{2}+i"$ doesn't change anything mod $p$, because $10^{\frac{p-1}{2}}\equiv 1\ (mod \ p)$ So assume that B chooses numbers $1\leq i\leq \frac{p-1}{2}$. Then $a_0+\cdots a_{p-1}10^{p-1}\equiv 0+9\cdot (10^1+10^2+\cdots +10^{\frac{p-1}{2}})\equiv 10\cdot (10^{\frac{p-1}{2}}-1)\equiv 0 (mod \ p)$So A wins. We are done
03.10.2021 10:31
Muradjl wrote: Let $ p \geq 2$ be a prime number. Eduardo and Fernando play the following game making moves alternately: in each move, the current player chooses an index $i$ in the set $\{0,1,2,\ldots, p-1 \}$ that was not chosen before by either of the two players and then chooses an element $a_i$ from the set $\{0,1,2,3,4,5,6,7,8,9\}$. Eduardo has the first move. The game ends after all the indices have been chosen .Then the following number is computed: $$M=a_0+a_110+a_210^2+\cdots+a_{p-1}10^{p-1}= \sum_{i=0}^{p-1}a_i.10^i$$. The goal of Eduardo is to make $M$ divisible by $p$, and the goal of Fernando is to prevent this. Prove that Eduardo has a winning strategy. Proposed by Amine Natik, Morocco Beautiful! Solved with guptaamitu1 For convenience let Eduardo be called A and Fernando be called B. If \(\gcd(p,10)>1\), then let A choose \(a_0=0\). This does the job. Otherwise, let A choose \(a_0\) as \(0\) again. Whenever B chooses an index \(k\), let A choose index \(\frac{p-1}{2}+k\). If B chooses\(a_k=x\), then let \(A\) choose \(x\) if the order of \(10\) with respect to \(p\) divides \(\frac{p-1}{2}\) and \(9-x\) otherwise. This strategy works because if we add the elements \(10^{k}a_k\) and \(10^{\frac{p-1}{2}+k}a_{\frac{p-1}{2}+k}\), the result is a multiple of \(p\), so the total sum in the end is a multiple of \(p\), solving the problem.
06.12.2021 01:25
Notice that for $p<10$, on the very last move of the game, Eduardo can make $M$ equal to any residue he wants modulo $p$ (by choosing an $a_i$ equal to a number from $0$ through $p-1$). Therefore assume that $p>10$. Notice that $10^{p-1}\equiv 1 \pmod p$ by FLT. We claim that Eduardo can win no matter what $p$ is by choosing $a_0$ to be $0$. We take cases based on $10^{\frac{p-1}{2}}$ modulo $p$. Let the partial M in the middle of the game be the value of $M$ if the remaining $a_i$ were all chosen to be $0$. Case 1: $10^{\frac{p-1}{2}}\equiv -1 \pmod p$. Then if Fernando chooses $X$ for $a_i$, Eduardo chooses $X$ for $a_{i-\frac{p-1}{2}}$ or $a_{i+\frac{p-1}{2}}$ to be $X$, whichever one exists. After Eduardo's first turn, the partial M is equivalent to $0$ modulo $p$. After a set of turns, the partial $M$ increases by $X(10^{i})+X(10^{i \pm \frac{p-1}{2}})$ for a choice of $+$ or $-$. However, as $10^{\frac{p-1}{2}}\equiv -1 \pmod p$, the change in the partial M modulo $p$ is equal to $10^i\cdot X \cdot (1+10^{\frac{p-1}{2}}) \equiv 0 \pmod p$. Therefore, $M$ will be a multiple of $p$. Case 2: $10^{\frac{p-1}{2}}\equiv 1 \pmod p$. Then if Fernando chooses $X$ for $a_i$, Eduardo chooses $9-X$ for $a_{i-\frac{p-1}{2}}$ or $a_{i+\frac{p-1}{2}}$ to be $X$, whichever one exists. After a set of turns, the partial $M$ increases by $X(10^{i})+(9-X)(10^{i \pm \frac{p-1}{2}})=9\cdot 10^i$ modulo $p$. Therefore, after the game is over, $M$ modulo $p$ will be equal to $$\sum_{i=1}^{\frac{p-1}{2}} 9\cdot 10^i \equiv 10 \sum_{i=0}^{\frac{p-1}{2}-1} 9\cdot 10^i \equiv 10 (10^{\frac{p-1}{2}} -1) \equiv 0.$$ This finishes the proof.
30.12.2021 21:28
Note that if $p=2,5$, then selecting $a_0=0$ automatically wins. Otherwise, note that at least one of $ord_p(10)$ or $\frac{p-1}{ord_p(10)}$ is even. Either way, Eduardo can select $a_0=0$ and mirror to finish. If $ord_p(10)$ is even, then we have $10^{\frac12 ord_p(10)}\equiv -1\pmod{p}$. Thus, Eduardo can find a perfect matching of the powers of 10 into pairs $(i,j)$ such that $10^i \equiv -10^j$. Thus, if Fernando places $a_i$, then Eduardo places $a_j =a_i$ which means that after every one of Eduardo's turns, the sum is still $\equiv 0\pmod{p}$ and we're done. If $\frac{p-1}{ord_p(10)}$ is even, first choose $a_0=0$. Then we can partition $\{10,10^2,\cdots 10^{p-1}\}$ mod $p$ into residue classes, each of which has an even number of occurrences. Eduardo can construct a perfect matching with pairs $(i,j)$ such that $10^i\equiv 10^j$, and if Fernando selects $a_i$, then Eduardo selects $a_j = 9-a_i$. Thus, the total sum will be \[0 + \frac{9}{2} \cdot (10+10^2+\cdots 10^{p-1})\equiv 0+0=0\pmod{p} \]Thus, for all $p$ Eduardo can guarantee victory and we're done. $\blacksquare$.
24.03.2022 04:49
Easier than how it look, though it was very fun. The motivation of this move is quite simple, i remembered Euler's criterion of quadratic residues so i knew that $10^{\frac{p-1}{2}} \equiv \left(\frac{10}{p} \right) \pmod p$ for $p$ odd and $\gcd(10,p)=1$, now if i was able to deal with $p=2,5$ then i would try to match any move of Fernando so that Eduardo can always do something abt any Fernando move. Case 1: $p=2$ Then its enough to pick $a_0=0$ as Fernando would have to pick $a_1=1$ and so $M=10$ which makes Eduardo win as $2 \mid 10$ Case 2: $p=5$ The strategy seems to be straight once u realice the trick, again use $a_0=0$ and then fernando loses as $5 \mid 10$ and by letting $a_0=0$ u make $10 \mid M$ so $5 \mid M$ as desired. Case 3: $\gcd(10,p)=1$ Then here we divide in 2 sub-cases. Case 3.1: $10$ is a quadratic residue mod $p$ Then $10^{\frac{p-1}{2}} \equiv 1 \pmod p$ so now after eduardo sets $a_0=0$ we do the following matching, if Fernando does $a_i=a$ then Eduardo does $a_{i+\frac{p-1}{2}}=9-a$ if $i \in \left(1,\frac{p-1}{2} \right)$ and if fernando does $a_i=b$ then Eduardo does $a_{i-\frac{p-1}{2}}=9-b$ if $i \in \left(\frac{p+1}{2},p-1 \right)$. Now it remains to show that this pairing works. Now take mod $p$ to $M$ and note this, if u have the $i$-th coefficient $a_i \cdot 10^i$ where $i \in \left(0,\frac{p-1}{2} \right)$ then adding with the $i+\frac{p-1}{2}$-th coefficient and then mod $p$ we get $a_i \cdot 10^i+a_{i+\frac{p-1}{2}} \cdot 10^{i+\frac{p-1}{2}} \equiv a_i \cdot 10^i+(9-a_i) \cdot 10^i \equiv 9 \cdot 10^i \pmod p$ and using this result on $M$ and taking mod $p$ we get $$M \equiv 9 \sum_{i=1}^{\frac{p-1}{2}} 10^i=10(10^{\frac{p-1}{2}}-1) \equiv 0 \pmod p$$Hence we got $p \mid M$ as desired Case 3.2: $10$ is not a quadratic residue mod $p$ Fhe first move of Eduardo will be $a_0=0$ and then we do this, if fernando picks $a_i=a$ where $i \in \left(0, \frac{p-1}{2} \right)$ then Eduardo picks $a_{i+\frac{p-1}{2}}=a$ and if fernando picks $a_i=b$ where $i \in \left(\frac{p+1}{2},p-1 \right)$ then Eduardo picks $a_{i-\frac{p-1}{2}}=b$, now note that $10^{p-1}{2} \equiv -1 \pmod p$ due to the case we are given, so now we test that our matching works, let $i \in \left(0,\frac{p-1}{2} \right)$ then $a_i \cdot 10^i+a_{i+\frac{p-1}{2}} \cdot 10^{i+\frac{p-1}{2}} \equiv a \cdot 10^i-a \cdot 10^i \equiv 0 \pmod p$ so adding all of these we get $p \mid M$ as desired . Since in all the cases we just let Eduardo win no matter what Fernando does, we are done
15.07.2022 05:14
It's obvious how to do it for $p=5$ so we'll assume $10$ is relatively prime to $p$. Eduardo can start by setting $a_{p-1}=0$. Case 1: $\text{ord}_p(10)$ is even This way, $10^\frac{\text{ord}_p(10)}{2}\equiv 1\pmod{p}$. So, each $0\leq k< p-1$ can be paired with a value $0\leq j<p-1$ such that $10^k+10^j\equiv 0\pmod{p}$. When Fernando sets $a_k$ to $m$, Eduardo can set its pair $a_j$ to $m$. This way, after Eduardo's turn, the sum will always be a multiple of $p$. Case 2: $\text{ord}_p(10)$ is odd Then, since $\frac{p-1}{\text{ord}_p(10)}$ is even, for each residue $r\pmod{p}$, there are an even number of values $0\leq k<p-1$ with $10^k\equiv r\pmod{p}$. So,the integers from $0$ to $p-2$ inclusive can be split into pairs such that if $k$ and $j$ are paired, $k\equiv j\pmod{p}$. So, if Fernando sets $a_k$ to $m$, Eduardo can set its pair $a_j$ to $9-m$. When the game is over, $M=9(10^0+10^1+\cdots+10^{p-2})=9\cdot\frac{10^{p-1}-1}9=10^{p-1}-1$, which is divisible by $p$ by FLT.
21.07.2022 01:44
For $p=2$ and $p=5$, Eduardo can take $a_0=0$ and he automatically wins. Otherwise let $k=\mathrm{ord}_p(10)$. We proceed with casework. $k$ is even: Eduardo can win by starting with $a_{p-1}=0$. If Fernando plays the digit $d$ on $a_r$, then Eduardo plays the digit $d$ on $a_{r+\frac{p-1}{2}}$, where indices cycle $\pmod{p-1}$. This obviously works because $10^{\frac{p-1}{2}} \equiv -1 \pmod{p}$, so Eduardo negates whatever Fernando plays every turn. $k$ is odd: Eduardo can win by starting with $a_{p-1}=0$. If Fernando plays the digit $d$ on $a_r$, then Eduardo plays the digit $9-d$ on $a_{r+\frac{p-1}{2}}$, where indices cycle $\pmod{p-1}$. Since $10^{\frac{p-1}{2}} \equiv 1 \pmod{p}$, we have that $$M \equiv \sum_{i=0}^{\frac{p-3}{2}} (a_i \cdot 10^i + (9-a_i) \cdot 10^{i+\frac{p-1}{2}}) \equiv \sum_{i=0}^{\frac{p-3}{2}} 9 \cdot 10^i \equiv 10^{\frac{p-1}{2}}-1 \equiv 0 \pmod{p},$$and this finishes the casework and we are done.
29.07.2022 20:27
If $p=2$ or $5$ Eduardo lets $a_0=0$ and wins. Let $k=\frac{p-1}{2}.$ $~$ If $p\neq 2$ or $5$ we have whatever index $i$ Fernando chooses, Eduardo chooses the index $j$ such that $j\equiv i\pmod k.$ Thus, the contribution of that round to the sum will be equivalent to $10^i(a_i+a_{i+k}10^k).$ $~$ If $10^k\equiv 1\pmod p$ then pick $a_{i+k}=9-a_i$, the sum will be $\equiv 9\cdot 10^i\pmod p$ so $M\equiv 90+900+\dots+9\cdot 10^k\equiv 10^{k+1}-10\equiv 0\pmod p$ so Eduardo wins. $~$ If $10^k\equiv -1\pmod p$ then pick $a_{i+k}=a_1$, the sum will be $\equiv 0\pmod p$ so we are already done.
19.12.2022 06:04
For $p=2$ and $p=5$, Eduardo just chooses $a_0=0$ and clearly wins. If $p\notin\{2,5\}$, then Eduardo first chooses $a_{p-1}=0$. Now consider the sets $$\left\{0,\frac{p-1}{2}\right\},\left\{1,\frac{p-1}{2}+1\right\},\dots,\left\{\frac{p-1}{2}-1,p-2\right\}.$$We split into two cases based on $10^{(p-1)/2}$ mod $p$. Case 1, $10^{(p-1)/2}\equiv -1\pmod p$: Whenever Fernando places $m$ in $a_i$, if $\{i,j\}$ is one of the sets, Eduardo can respond by placing $m$ in $a_j$. This is because $$1+10^{(p-1)/2}\equiv 1-1=0\pmod p$$and clearly finishes. Case 2, $10^{(p-1)/2}\equiv 1\pmod p$: Whenever Fernando places $m$ in $a_i$, if $\{i,j\}$ is one of the sets, Eduardo can respond by placing $9-m$ in $a_j$. This is because $$9+9\cdot10+9\cdot10^2+\dots+9\cdot10^{(p-1)/2-1}=10^{(p-1)/2}-1\equiv 0\pmod p$$and clearly finishes.
19.12.2022 13:25
If $p=2$ or $p=5$ Eduardo wins by writing $0$ in the ones place. Henceforth assume $\gcd(p,10)=1$. First, Eduardo writes $0$ in the $10^{p-1}$ place. Case 1: $10^{\frac{p-1}2} \equiv -1 \mod p$ If Fernando writes a digit $d$ in the $10^i$ place, then Eduardo writes $i$ in the $10^{\frac{p-1}{2} + i}$ place (here taking the exponents $\mod p-1$) Case 2: $10^{\frac{p-1}2} \equiv 1 \mod p$ If Fernando writes a digit $d$ in the $10^i$ place, then Eduardo writes $9-i$ in the $10^{\frac{p-1}{2} + i}$ place (again taking the exponents $\mod p-1$) Then we see that at the end, the number is clearly divisible by $p$, as desired.
07.10.2023 00:52
If $p=\{2,5\}$ then Ankan wins with $a_0=0$; henceforth disregard those cases. Case 1: $10^{\frac{p-1}2} \equiv -1 \pmod p$. Ankan starts off by setting $a_{p-1}=0$, and wherever Ryan chooses $a_i=k$ Ankan chooses $a_{\frac{p-1}2+i\pmod{p-1}}=k$, which obviously cancel out mod p. Case 2: $10^{\frac{p-1}2} \equiv 1 \pmod p$. Ankan starts off by setting $a_{p-1}=9$, and wherever Ryan chooses $a_i=k$ Ankan chooses $a_{\frac{p-1}2+i\pmod{p-1}}=9-k$, which obviously cancels to $\sum_{i=0}^{\frac{p-1}2-1}10^i9\equiv9\frac{10^{\frac{p-1}2+1}-1}{10-1}\equiv0\pmod p$, done.
28.11.2023 05:41
Case 1: $10$ is a primitive root $\pmod p$ After reducing all the coefficients $\pmod p$, we will simply get that the coefficients make up $\mathbb{Z}_p$. Eduardo can let $a_0 = 0$ on his first turn, and then if Fernando picks $a_i$ with coefficient $k$, Eduardo can simply make the index $a_j$ with coefficient $p-k$ equal to $a_i$. This clearly makes the sum $0 \pmod p$. Case 2: $10$ is not a primitive root $\pmod p$ Let the order of $10 \pmod p$ be $d$. As before, for the first move Eduardo can let $a_0 = 0$ on his first move. Now, if Fernando picks $a_i$ with coefficient $10^x$, Eduardo needs to simply take an index $a_j$ with coefficient $10^y$ where $x \equiv y \pmod d$, and set $a_j = 9-a_i$. Now, in the set of all numbers $y \equiv x \pmod d$ and $y < p-1$ for a specific $x$, either Eduardo or Fernando can choose the last number out of these. Notice that if $\frac{p-1}{d}$ is odd then Fernando must be the one who "completes" a residue set first. Now for the next residue set, Eduardo can simply do the above strategy and then copy what Fernando put when they completed their residue set when he (Eduardo) is completing the second residue set. Now since $d$ would be even, Eduardo and Fernando complete the same number of residue sets, meaning that Eduardo would successfully be able to copy Fernando. The sum for a residue set would be equal to $C \cdot 10^x$ where $C$ is a constant because Eduardo completion would be identical to Fernando's completion. Summing over all $x \pmod d$, we will simply get $0 \pmod p$. Now if $\frac{p-1}{d}$ is even, Eduardo will always be completing a residue set meaning that he can simply just choose $0$. We will end up with what we had in the previous sentences, so we are done. Case 3: $p = 2, 5$ Eduardo can simply just choose $a_0 = 0$ and he wins. EDIT: a part of case 2 is a fakesolve, will fix tomorrow
28.11.2023 05:46
0 points: no answer
28.11.2023 15:00
pi271828 wrote: Case 1: $10$ is a primitive root $\pmod p$ After reducing all the coefficients $\pmod p$, we will simply get that the coefficients make up $\mathbb{Z}_p$. Eduardo can let $a_0 = 0$ on his first turn, and then if Fernando picks $a_i$ with coefficient $k$, Eduardo can simply make the index $a_j$ with coefficient $p-k$ equal to $a_i$. This clearly makes the sum $0 \pmod p$. Case 2: $10$ is not a primitive root $\pmod p$ Let the order of $10 \pmod p$ be $d$. As before, for the first move Eduardo can let $a_0 = 0$ on his first move. Now, if Fernando picks $a_i$ with coefficient $10^x$, Eduardo needs to simply take an index $a_j$ with coefficient $10^y$ where $x \equiv y \pmod d$, and set $a_j = 9-a_i$. Now, in the set of all numbers $y \equiv x \pmod d$ and $y < p-1$ for a specific $x$, either Eduardo or Fernando can choose the last number out of these. Notice that if $\frac{p-1}{d}$ is odd then Fernando must be the one who "completes" a residue set first. Now for the next residue set, Eduardo can simply do the above strategy and then copy what Fernando put when they completed their residue set when he (Eduardo) is completing the second residue set. Now since $d$ would be even, Eduardo and Fernando complete the same number of residue sets, meaning that Eduardo would successfully be able to copy Fernando. The sum for a residue set would be equal to $C \cdot 10^x$ where $C$ is a constant because Eduardo completion would be identical to Fernando's completion. Summing over all $x \pmod d$, we will simply get $0 \pmod p$. Now if $\frac{p-1}{d}$ is even, Eduardo will always be completing a residue set meaning that he can simply just choose $0$. We will end up with what we had in the previous sentences, so we are done. Case 3: $p = 2, 5$ Eduardo can simply just choose $a_0 = 0$ and he wins. EDIT: a part of case 2 is a fakesolve, will fix tomorrow This solution gets the $\frac{p-1}{d}$ odd part in Case 2 wrong, as Fernando can change the number he put when he completes different residue sets. To fix, you can just see that that implies $10^{\frac{p-1}{2}} \equiv -1 \pmod p$ and now Eduardo can choose the $10^{p-1}$ for the first term and set it to $0$ and if Fernando sets $a_i = k$, Eduardo can set $a_{i\pm\frac{p+1}{2}} = k$. In hindsight the $\frac{p-1}{d}$ even case is just equivalent to $10^{\frac{p-1}{2}} = 1$, and then doing a similar method as above would have been a lot easier (but I think the method for this case in the solution is correct). A lot of the above solutions do this I think, but oh well.
30.12.2023 03:41
Divide the terms into pairs $\{10^k, 10^{(p-1)/2 + k}\}$ for each $0 \leq k < \frac{p-1}2$. (In particular, $10^{p-1}$ is not part of a pair.) If $10^{(p-1)/2} \equiv 1 \pmod p$, Eduardo can first assign $0 = a_{p-1}$. Then if Fernando assigns $i$ to some element in a pair, Eduardo assigns $9-i$ to the corresponding element in the pair. It follows that $$N \equiv \frac 92 (1+10+10^2+\cdots+10^{p-2}) \equiv \frac 12(10^{p-1} - 1) \equiv 0 \pmod p.$$If $10^{(p-1)/2} \equiv -1 \pmod p$, Eduardo's job is even easier! Just assign $0 = a_{p-1}$ again, and if Fernando assigns $i$ to some element in a pair, Eduardo can just assign $i$ to the other element.
23.02.2024 20:45
Eduardo wins, we divide in two cases, as $10^{\frac{p-1}{2}}\equiv \pm 1\pmod p$ $\textcolor{blue}{ \text{If} \hspace{0.2cm} 10^{\frac{p-1}{2}}\equiv -1\pmod p}$ [asy][asy] size(9cm); int n=6; label("0", (2n+0.5,0.5)); for (int i = 0; i <= n; ++i){ draw((2i,0)--(2i+1,0)); label("$a_" + string(n - i) + "$", ((4i+1)/2,-1)); draw((n-0.5,-1.5)--(n-0.5,1.5)); draw((2n-0.5,-1.5)--(2n-0.5,1.5)); } for (int i = 0 ; i <= n/2-1; ++i){ label(string(n/2 - i), ((4i+1)/2,0.5)); label(string(n/2 - i), ((4i+1)/2+n,0.5)); } [/asy][/asy] Here Eduardo starts by writing a $0$ in $a_0$ then, we divide now, the $p-1$ remaining cells in two groups, then Eduardo will "copy" the moves of Fernando but in the other side, in this way we would have a number of the form $\overline{\text{blabla}}\left(10^{\frac{p-1}{2}}+1\right)$ which is $0\pmod p$ $\textcolor{blue}{ \text{If} \hspace{0.2cm} 10^{\frac{p-1}{2}}\equiv 1\pmod p}$ [asy][asy] size(9cm); int n=6; label("0", (2n+0.5,0.5)); for (int i = 0; i <= n; ++i){ draw((2i,0)--(2i+1,0)); label("$a_" + string(n - i) + "$", ((4i+1)/2,-1)); draw((n-0.5,-1.5)--(n-0.5,1.5)); draw((2n-0.5,-1.5)--(2n-0.5,1.5)); } for (int i = 0 ; i <= n/2-1; ++i){ label(string(n/2 - i), ((4i+1)/2,0.5)); label(string(9-n/2 + i), ((4i+1)/2+n,0.5)); } [/asy][/asy] Here, Eduardo also starts with writing a $0$ in $a_0$ and in his followings moves he "copy" the places of Fernando moves but instead of writing the same number he writes $9-d$ where $d$ is the digit that Fernando wrote, and note that we finish with a number which is \[9\left(10+10^2+\cdots 10^{\frac{p-1}{2}}\right)\equiv 9\left(\frac{10^{\frac{p+1}{2}}-1}{10-1}-1\right)\equiv 0\pmod p \]
24.04.2024 16:54
The cases $p\in \{2,3,5\}$ are handled easily. Eduardo plays $a_{p-1}=0$ first. Let $s=\text{ord}_{p}(10)$. If $s$ is even, then split $a_i$ by $\lfloor i/s\rfloor$. Now in each group of $s$ values, we have $10^i$ equivalent to either $10^{i+s/2}$ or $10^{i-s/2}$ depending on whether $i$ modulo $s$ is greater or less than $s/2$. This naturally induces pairs; if Fernando plays in one pair then Eduardo plays the same in the other value in the pair, cancelling out to $0$. If $s$ is odd, then split $a_i$ by $\lfloor i/2s\rfloor$. Then pair again the indices $a_i$ and $a_{i+s}$ or $a_{i-s}$ depending on $i$ modulo $2s$. Then if Fernando chooses a coefficient $c\in \{0,\dots,9\}$ then Eduardo plays in the other value of the pair the coefficient $9-c$. It suffices to prove now that \[1+\dots+10^{s-1}\equiv 0\pmod p\]or just \[\frac{10^s-1}{9}\equiv 0\pmod p\]which is fine. $\blacksquare$
05.06.2024 04:03
We claim that Player 1 has a winning strategy, which starts by assigning $a_0 = 0$. Notice the game is won if $p=2,5$. Otherwise, the trick is to pair the $p-1$ remaining indices. Suppose Player 2 places digit $n$ in index $i$ on any given term. Then, in index $i \pm \tfrac{p-1}{2}$ (whichever is valid), if: $10^{(p-1)/2} \equiv 1 \pmod p$: Player 1 places digit $9-n$. $10^{(p-1)/2} \equiv -1 \pmod p$: Player 1 places digit $n$. The resulting $N$ is guaranteed a fixed residue modulo $p$, which can be determined to be 0. $\blacksquare$
15.12.2024 00:30
storage