The numbers $1, 2, 3, \dots, 1024$ are written on a blackboard. They are divided into pairs. Then each pair is wiped off the board and non-negative difference of its numbers is written on the board instead. $512$ numbers obtained in this way are divided into pairs and so on. One number remains on the blackboard after ten such operations. Determine all its possible values. Proposed by A. Golovanov
Problem
Source: Tuymaada 2018 Junior League/Problem 6
Tags: combinatorics, combinatorics solved, invariant, Parity, blackboard
21.07.2018 10:35
It's clear that all possible values must have same parity with $1+2+3+\cdots +1024\equiv 0\pmod{2}$. Also, the absolute value must be strictly less than $1024$. The possibilities left are $0,2,4,6,\dotsc ,1022$. All of those values are possible since we can create the following operations: $$1024-(2i+1),\underbrace{1,1,\dotsc ,1}_{2^9-1}\implies1024-(2i+2),\underbrace{0,0,\dotsc ,0}_{2^8-1}\implies \cdots \implies 1024-(2i+2)$$for all $i=0,1,2,\dotsc ,511$.
10.11.2019 21:25
We claim all the evens are achievable: $0,2,4,\ldots,2^{10}-2$. Algorithm for evens: For some $1\le k \le 2^9$, take \begin{align*} &~ (1,2k), (2,3), (4,5), \ldots, (2k-2,2k-1), (2k+1,2k+2), \ldots, (2^{10}-1, 2^{10}) \\ &\to 2k-1, 1, 1, \ldots, 1 \qquad \text{(note that there are an odd number of 1's)} \\ &\to (2k-1, 1), (1,1), (1,1), \ldots, (1,1) \\ &\to 2k-2, 0, 0, \ldots, 0 \\ &\vdots \\ &\to 2k-2. \end{align*}To prove we cannot get odds, simply note that the sum is invariant (mod 2).
24.08.2021 03:38
The answer is all even numbers less than 1024. First, we show that it is impossible to end with an odd integer. It suffices to show that the parity of the sum of the numbers on the board is an invariant -- this is true because for any two numbers $a, b$, $a+b$ and $|a-b|$ have the same parity. Yet $1+2+3+\cdots+1024$ is clearly even, so it is impossible to end with an odd number. Next, we provide a construction for all even numbers. To attain the final number $n=2k$, consider the four numbers $512-k, 512, 513, 513+k$. Pair all the integers before $512-k$ and after $513+k$ in consecutive pairs, while pair 512 and 513 together, and $512-k$ and $513-k$ together. If $k$ is odd, then we can pair the numbers between $512-k$ and $512$ in consecutive pairs, and the same for $513$ and $513+k$. If $k$ is even, then we can also group in consecutive pairs, grouping the remaining two elements $(513-k, 511-k)$ and $(512+k, 514+k)$ in their own pairs. After performing the operation, we are left with the differences $$1, 2k+1, 1, 1, 1, \cdots, 1$$and possibly two 2's. Now, there are an even number of 1'a and 2's at the blackboard on this point, so pair each 1 with another 1, and each 2 with another 2. Furthermore, pair $2k+1$ with 1. Under the next operation, we obtain all zeroes on the whiteboard except for a single $2k$. It is trivial that the final number on the whiteboard at this point will be $2k$, as desired.
15.09.2021 06:40
Note that the number at the end clearly should be even, since the parity of the sum of all elements at any move remains invariant. Next, that number cannot be greater than \(1022\). We now show that all numbers \(2,4,\hdots,1022\) can remain in the end. We pair the numbers as follows: \[\left(2^{10},2k+1\right),\left(a_1,b_1\right),\hdots,\left(a_{511},b_{511}\right)\]where \(|a_i-b_i|=1\) and that none of \(a_i\) or \(b_i\) is \(2^{10}\) or \(2k+1\) for all \(k\geq0\) and \(1\leq i\leq511\). This pairing will reduce to the numbers \[2^{10}-2k-1,1,1,\hdots,1\]where that \(1\) occurs \(511\) times. Now, we pair \(2^{10}-2k-1\) with one of those \(1\)'s and pair the remaining \(1\)'s with themselves to get the new set of numbers \[2^{10}-2k-2,0,0,\hdots,0\]where there are \(257\) zeroes. Now, no matter what pairing you make, in the end you will be left with \(2^{10}-2k-2\) which covers all even numbers from \(2\) to \(1022\).
15.09.2021 07:38
Since $|a-b| \equiv a+b \pmod{2}$, we know the final number must be even, as $$\sum_{i=1}^{1024} i = \frac{1024 \cdot 1025}{2} \equiv 0 \pmod{2}.$$Now, we claim all evens from $0$ to $1022$ are possible end values. To get $2k$ as the final number for $1 \le k \le 511$, we pair up $$\{1, 2k+2\}; \{2, 3\}, \{4, 5\}, \ldots, \{2k, 2k+1\}; \{2k+3, 2k+4\}, \{2k+5, 2k+6\}, \ldots, \{1023, 1024\}$$for the first iteration. This yields the terms $$\{\underbrace{1, 1, \ldots, 1}_{511\rm\ \text{times}}, 2k+1\}.$$Now, it's easy to see the next iteration will yields the terms $$\{\underbrace{0, 0, \ldots, 0}_{255\rm\ \text{times}}, 2k\}$$implying our final term will be $2k$. To get $0$ as our final term, we can pair up $$\{1, 2\}, \{3, 4\}, \ldots, \{1023, 1024\} \rightarrow \underbrace{\{1, 1, \ldots, 1\}}_{512\rm\ \text{times}} \rightarrow \underbrace{\{0, 0, \ldots, 0\}}_{256\rm\ \text{times}}$$which obviously yields a final term of $0$. To finish, we observe all evens greater than $1022$ cannot be the final number, as all terms after one iteration are already less than $1024$, and the value of the largest term on our blackboard is non-increasing. $\blacksquare$ Remark: The solution set surprised me, as I was expecting it to be less general than "all evens from $p$ to $q$".
17.09.2021 09:45
We make the following claim: The only solutions are any numbers $2k$ with $k \in \{0, 1,2,\cdots, 511\}$ Note that all the above solutions can be achieved with the following algorithm For the first partition, select $(1,2k+2)$ (which works for all the $k$'s mentioned above) and $(2,3), (4,5), \cdots (2k,2k+1), (2k+3, 2k+4), \cdots (1023,1024)$ Which leads to $\{ 2k+1,1,1,1,\cdots 1\}$ with 511 $1$'s Now we choose $(1,2k+1)$ and 255 pairs of $(1,1)$ which gives $\{2k,0,0,0,\cdots 0\}$ and this obviously will end up as $2k$ with any random pairing Now, note that in any pair $(a,b)$ with $a>b$ the sum was $a+b$ and it got replaced by the single number $a-b$, that is it reduced by $2b$. Hence the parity of the sum of all numbers doesn't change and $1+2+3+\cdots 1024$ is even $\Rightarrow$ the final number must be even
22.10.2021 18:11
The claim is that the answer is any even number upto $1022$. Observe that for any number $2k, 1\leq k\leq 511,$ in the first step, we can pair up $1$ and $2k+2$ and then pair all the other consecutive numbers. So we will get the numbers $2k+1, 1,1,\dots, 1$ ($512$ terms). Then we apply next step and pair $2k+1$ and $1$ and all other consecutive $1$'s. So we now get the numbers $2k,0,0,\dots,0$ ($256$ terms.) And form here, we clearly see we will be left with $2k, 1\leq k\leq 511.$ Now observe that previous algorithm cannot give $1024$ at last that is because we cannot take any number greater than $1024$. And also in any pairing of a number with $1024$ we will only reduce $1024$ in each step. So clearly this process cannot terminate in $1024.$ So at last we have to prove that we cannot obtain an odd number at last. To do this, simply observe that, if $S=1+2+\cdots+1024,$ them at each step we are replacing any pair $(a,b)$ with $2\cdot$min$(a,b)$, which is even. This is an invariant. So since $1024$ numbers which is even, we must end up with an even number. Proof complete.
22.10.2021 20:05
ACGNmath wrote: The numbers $1, 2, 3, \dots, 1024$ are written on a blackboard. They are divided into pairs. Then each pair is wiped off the board and non-negative difference of its numbers is written on the board instead. $512$ numbers obtained in this way are divided into pairs and so on. One number remains on the blackboard after ten such operations. Determine all its possible values. Proposed by A. Golovanov
28.12.2021 05:40
all Evan number $\le n$
13.08.2022 10:49
As clearly $1024$ cannot be achieved, we are done.
22.08.2022 22:24
I really had to overcomplicate this didn't I...
24.09.2022 19:45
The answer is all nonnegative even integers less than $1024.$ Notice by combining all the numbers, we are multiplying each number by a factor of $-1.$ Since $-1\equiv 1\pmod{2}$ and $-0\equiv 0\pmod{2},$ the final number is congruent to $1+2+\dots+1024\equiv 0\pmod{2},$ so the final number has to be even. Also, the value cannot be $1024$ as after the first step there will be no numbers greater than $1023.$ We claim all of $0,2,4,\dots,1022$ work. For an even integer $2m$ with $0\le m\le 2^9-1,$ pair $1024$ with $1023-2m$ and pair $k$ with $k+1$ for \begin{align*}k&=1,3,5,\dots,1021-2m,\\&1024-2m,1026-2m,\dots,1024-2.\end{align*}Then, we are left with $2m+1$ and $511$ ones. For the next step, pair $2m+1$ with a one and pair all the other ones with each other, so we are left with $255$ zeros and $2m.$ It is clear that the last number left must be $2m,$ as desired. $\square$
03.10.2022 14:36
25.02.2023 02:22
By parity, the sum of all numbers on the blackboard is always even, so the final number is even. Clearly, this even number must be at least $0$ and strictly less than $1024$; all such numbers can be constructed. To construct $n$, we pair up $(1023-n, 1024)$, and pair the rest of the numbers by \[(1,2), (3,4), \dots, (1021-n,1022-n), (1024-n, 1025-n), \dots, (1020,1021), (1022,1023).\]Then, we are left with $1+n$ and $511$ ones. There is only one way to pair these numbers up; afterwards, we are left with one $n$ and $255$ zeroes; we will inevitably be left with $n$.
23.11.2023 20:32
29.12.2023 22:46
Only even that are $< 1024$ work. Note that if we express the final number as $\pm 1 \pm 2 \pm \cdots \pm 1024$ which we get after doing our operations but not combining the initial numbers, then taking $\pmod{2}$ gives that this is congruent to $1+ 2+\cdots+1024=\dfrac{1024\times 1025}{2}$ which is clearly divisible by $2$. So our final number must be divisible by $2$. Now for getting $2k-2$ we can get it from the following construction for $1\le k \le 512$. $(2k,1);(2,3);(2k-2,2k-1);(2k+1,2k+2);(2k+3,2k+4);\ldots;(1023,1024)$ $\downarrow$ $(2k-1,1);(1,1);(1,1);\ldots$ $\downarrow$ $(2k-2,0);(0,0);(0,0);\ldots$ $\downarrow$ $\vdots$ $\downarrow$ $2k-2$. Clearly $\ge 1024$ is not achievable since the maximum in the sequence is $1024$ and it must decrease by at least $1$ through the entire moves.
29.05.2024 04:33
We claim the answer is all nonnegative even integers less than $1024$. Note that $|a - b| = a + b$, hence the parity of the final integer is the same as $1 + 2 + \dots + 1024 = \frac{1024 \cdot 1025}{2} = 512 \cdot 1025$ which is clearly even. Now to show attainability, suppose we want to end with the integer $2n$ where $0 \le n \le 511$. Then pair $1$ with $2n + 2$, and it is possible to group the other integers in consecutive pairs, resulting in $2n + 1, 1, 1, \dots, 1$. Then pair them again to get $2n, 0, 0, \dots, 0$ and it is easy to see we are left with $2n$. We are done.
24.07.2024 23:03
Note that the sum of the numbers on the board is always even which we can prove by induction. If the numbers on the board are $a_1, a_2, \dots$ then WLOG the sum of the numbers after will be $a_1 + a_2 + \dots - a_k - a_{k+1} - \dots$ which is even since $a_1 + a_2 + \dots$ and $a_k + a_{k+1} + \dots$ are the same parity clearly. So the final number must also be even. We will now show that all even numbers are constructable. First split the numbers so that we get $1024 - (2k-1)$, $1$, $1$, $\dots$ which is possible since $2k + 1$ is odd. Then split the numbers so we get $1024 - 2k$, $0$, $0$, $\dots$ from which we are left with $1024 - 2k$ as the final number on the board. Varying $k$ gives us any even nonnegative number less than $1024$.
28.01.2025 14:11
Note that, every even number $0, 2, \cdots, 2^10-2$ is achievable as: For $1 \le k \le 2^9$: $(1, 2k) (2, 3) (4, 5) \cdots (2k-2, 2k-1), (2k+1, 2k+2), \cdots$ $\implies 2k-1, 1, \cdots, 1$ $\implies 2k-2, 0, \cdots, 0$ $\cdots$ $2k-2$ Note that, we cant get odd numbers as, the parity of the sum of numbers on the board is invariant.