2014 Canadian MO Problems/Problem 5

Problem

Fix positive integers $n$ and $k\ge 2$. A list of n integers is written in a row on a blackboard. You can choose a contiguous block of integers, and I will either add $1$ to all of them or subtract $1$ from all of them. You can repeat this step as often as you like, possibly adapting your selections based on what I do. Prove that after a finite number of steps, you can reach a state where at least $n-k+2$ of the numbers on the blackboard are all simultaneously divisible by $k$.

Solution

We aim to prove that given $n$ positive integers written in a row on a blackboard, with $k \geq 2$, we can achieve a state where at least $n - k + 2$ numbers are simultaneously divisible by $k$ after a finite number of steps. For any number $a$ on the blackboard, consider its value modulo $k$, denoted $a \mod k$. Initially, each number $a$ can take one of the values $0, 1, \dots, k-1$ modulo $k$. The allowed operations, which involve adding or subtracting $1$ to all numbers in a contiguous block, cyclically adjust the residues of the selected block within $\{ 0, 1, \dots, k-1 \}$. This gives us complete control over the residues of the selected block modulo $k$.

Our goal is to ensure that at least $n - k + 2$ numbers are divisible by $k$, which corresponds to ensuring that their residues modulo $k$ are $0$. To do this, note that at every step, we can select a contiguous block of numbers and adjust their residues to reduce the number of distinct residues present among the $n$ numbers. Specifically, we aim to minimize the number of residues different from $0$. If fewer than $n - k + 2$ numbers are divisible by $k$, then more than $k - 2$ numbers must have non-zero residues.

By the pigeonhole principle, at least one residue $r \neq 0$ must appear more than once. Using our operations, we can choose a contiguous block of numbers containing all occurrences of $r$ (or a subset) and adjust their residues modulo $k$ to reduce $r$ towards $0$.

Repeating this process for different residues as necessary, we can iteratively increase the number of numbers divisible by $k$ until at least $n - k + 2$ numbers satisfy this property. The process must terminate after a finite number of steps because each operation reduces the sum of the absolute values of the residues modulo $k$ across all numbers. Since this sum is non-negative and decreases strictly with each operation, the process cannot continue indefinitely. Therefore, after a finite number of steps, we can ensure that at least $n - k + 2$ numbers are divisible by $k$. $\blacksquare$

~sitar