$1019$ stones are placed into two non-empty boxes. Each second Alex chooses a box with an even amount of stones and shifts half of these stones into another box. Prove that for each $k$, $1\le k\le1018$, at some moment there will be a box with exactly $k$ stones. (O. Izhboldin)
Problem
Source: 2019 Belarus Team Selection Test 2.3
Tags: number theory, primitive root, combinatorics
04.09.2019 04:26
Note that $1019$ is prime and $\frac{1019-1}{2} = 509$ is prime as well. Let $b_1, b_2$ be variables which correspond to the number of stones in the two boxes. Observe that $b_1 + b_2 = 1019$ at all times. Now, notice that every move halves each of $b_1, b_2$ modulo $1019.$ In other words, if $(b_1, b_2)$ are turned into $(b_1', b_2')$ after Alex does his shifting, then we have $1019 | b_1 - 2b_1', b_2 - 2b_2'.$ With this observation, it would suffice to prove that $2$ is either a primitive root modulo $1019$ or is the square of the primitive. This is equivalent to $ord_{1019}(2) \in \{509, 1019\}$, and so we just need to show that $ord_{1019}(2) \notin \{1, 2\}.$ However, this is obvious since $1019 \nmid 2^1 - 1, 2^2 - 1.$ $\square$
19.09.2023 02:40
Vlados021 wrote: $1019$ stones are placed into two non-empty boxes. Each second Alex chooses a box with an even amount of stones and shifts half of these stones into another box. Prove that for each $k$, $1\le k\le1018$, at some moment there will be a box with exactly $k$ stones. (O. Izhboldin) $\color{blue}\boxed{\textbf{Proof:}}$ $\color{blue}\rule{24cm}{0.3pt}$ Let $a_0, a_1, a_2,\ldots$ and $b_0, b_1, b_2,\ldots$ be $2$ sequences of positive integers, such that $a_i$ and $b_i$ are the number of stones in the first box and second box in the second $i$, respectively. Let's notice that: $$a_i+b_i=1019, \forall i\in\mathbb{Z}^+_0...(I)$$$\color{red}\boxed{\textbf{Claim 1:}}$ $\color{red}\rule{24cm}{0.3pt}$ $$a_i, b_i \not\equiv 0\pmod{1019}, \forall i\in \mathbb{Z}^+_0$$$\color{red}\rule{24cm}{0.3pt}$ $\color{red}\boxed{\textbf{Proof:}}$ $\color{red}\rule{24cm}{0.3pt}$ Suppose there exists $i$ such that $a_i$ or $b_i\equiv 0 \pmod{1019}$ $\text{WLOG } a_i\equiv 0\pmod{1019}$ By $(I):$ $$\Rightarrow b_i\equiv 0\pmod{1019}$$So regardless of which box stones were taken from in the previous turn we will have that in the previous turn a box will have a quantity $\equiv 0 \pmod{1019}$ Under this process we obtain that: $$a_0, b_0\equiv 0\pmod{1019}$$Since $a_0+b_0=1019$ $$\Rightarrow a_0 \text{ or }b_0=0 (\Rightarrow \Leftarrow)_\blacksquare$$$\color{red}\rule{24cm}{0.3pt}$ $\color{red}\boxed{\textbf{Claim 2:}}$ $\color{red}\rule{24cm}{0.3pt}$ $$a_{i}\equiv 2a_{i+1}\pmod{1019} \text{ and } b_{i}\equiv 2b_{i+1}\pmod{1019}, \forall i\in\mathbb{Z}^+_0$$$\color{red}\rule{24cm}{0.3pt}$ $\color{red}\boxed{\textbf{Proof:}}$ $\color{red}\rule{24cm}{0.3pt}$ $\text{WLOG }$half of the first box was taken out in the second $i$ $$\Rightarrow \frac{a_i}{2}=a_{i+1}$$$$\Rightarrow a_i=2a_{i+1}$$$$\Rightarrow a_i\equiv 2a_{i+1}\pmod{1019}_\blacksquare$$We also see that: $$b_i+\frac{a_i}{2}=b_{i+1}$$$$\Rightarrow 2b_i+a_i=2b_{i+1}$$Since $a_i+b_i=1019\equiv 0\pmod{1019}$ $$\Rightarrow b_i\equiv 2b_{i+1}\pmod{1019}_\blacksquare$$$\color{red}\rule{24cm}{0.3pt}$ Now since $gcd(2,1019)=1$ then $ord_{1019}2$ exists $$\Rightarrow ord_{1019}2|\varphi(1019)$$Since $1019$ is prime $\Rightarrow \varphi(1019)=1019-1=1018$ $$\Rightarrow ord_{1019}2|1018$$$$\Rightarrow ord_{1019}2=1, 2, 509 \text{ or }1019$$If $ord_{1019}2=1\Rightarrow 2^1\equiv 1\pmod{1019}(\Rightarrow \Leftarrow)$ If $ord_{1019}2=2\Rightarrow 2^2\equiv 1\pmod{1019}(\Rightarrow \Leftarrow)$ If $ord_{1019}2=1019\Rightarrow 2^{1019}=1, \text{By Fermat's Theorem }\Rightarrow 2^{1019-1}\equiv 1\pmod{1019}, \Rightarrow 2^1\equiv 1\pmod{1019}(\Rightarrow \Leftarrow)$ $$\Rightarrow ord_{1019}2=509...(II)$$$\color{red}\boxed{\textbf{Claim 3:}}$ $\color{red}\rule{24cm}{0.3pt}$ $$(a_0, a_1, a_2 ,\ldots, a_{508}, b_0, b_1, b_2, \ldots, b_{508}, 0) \text{ is a complete residue system modulo }1019$$$\color{red}\rule{24cm}{0.3pt}$ $\color{red}\boxed{\textbf{Proof:}}$ $\color{red}\rule{24cm}{0.3pt}$ Suppose there $\exists i<j<509 / a_i\equiv a_j\pmod{1019}\text{ or } b_i \equiv b_j\pmod{1019}$ $\text{WLOG } a_i\equiv a_j\pmod{1019}$ By $\color{red}\text{Claim 2:}2^{j-i}a_i\equiv a_j\pmod{1019}$ $$\Rightarrow a_i\equiv 2^{j-i}a_i\pmod{1019}$$By $\color{red}\text{Claim 1:}$ $$\Rightarrow 2^{j-i}\equiv 1\pmod{1019}$$By $(II):$ $$\Rightarrow 509|j-i<509$$$$\Rightarrow j-i=0$$$$\Rightarrow j=i (\Rightarrow\Leftarrow)$$$\Rightarrow \not\exists i<j<509 / a_i\equiv a_j\pmod{1019}\text{ or } b_i \equiv b_j\pmod{1019}...(1)$ Suppose there $\exists i<j<509 / a_i\equiv b_j\pmod{1019}\text{ or } b_i \equiv a_j\pmod{1019}$ $\text{WLOG }a_i\equiv b_j\pmod{1019}$ By $(I):$ $$\Rightarrow -b_i\equiv b_j\pmod{1019}$$By $\color{red}\text{Claim 2:} 2^{j-i}b_i\equiv b_j\pmod{1019}$ $$\Rightarrow -b_i\equiv 2^{j-i}b_i\pmod{1019}$$By $\color{red}\text{Claim 1:}$ $$\Rightarrow -1\equiv 2^{j-i}\pmod{1019}$$$$\Rightarrow 1\equiv 2^{2(j-i)}\pmod{1019}$$By $(II):$ $$\Rightarrow 509|2(j-i)$$$$\Rightarrow 509|j-i<509$$$$\Rightarrow j-i=0$$$$\Rightarrow j=i(\Rightarrow \Leftarrow)$$$\Rightarrow\not\exists i<j<509 / a_i\equiv b_j\pmod{1019}\text{ or } b_i \equiv a_j\pmod{1019}...(2)$ Note that by $(1), (2)$ and $Claim 1$ we obtain $Claim 3_\blacksquare$ $\color{red}\rule{24cm}{0.3pt}$ $$\text{Let's note that Claim 3 is what was requested}_\blacksquare$$$\color{blue}\rule{24cm}{0.3pt}$