Kvant Math Problem 678

Consider small examples first.

Verified: no
Verdicts: SKIP + SKIP
Solve time: 6m23s
Source on kvant.digital

Problem

A $2m$-digit number is called fair if its even positions contain as many even digits as odd ones. Prove that in any $2m+1$-digit number, it is possible to remove one digit so that the resulting $2m$-digit number is fair (Fig. 1).

A. F. Sidorenko

Exploration

Consider small examples first. Let $m=1$, so the number has $2m+1 = 3$ digits. Label the digits $a_1a_2a_3$. The even position is $a_2$. A $2$-digit number is fair if its even position has one even and one odd digit. Take the 3-digit number $135$. The even positions are just the second digit, $3$, which is odd. Removing $1$ or $5$ gives $35$ or $13$, respectively. The even position in each resulting 2-digit number is either $3$ or $1$, both odd. The parity balance fails. Removing the middle digit $3$ gives $15$, whose even position is $5$, odd. The balance still fails. Choose another 3-digit number $142$. Removing $1$ gives $42$, whose even position $2$ is even; the other digit $4$ is even. Not fair. Removing $4$ gives $12$, even in even position, 2 even digits, still not fair. Removing $2$ gives $14$, even in even position, 4 even, not fair. For $m=1$ the 2-digit number must have one even and one odd in positions 1 and 2; perhaps the claim requires a different reasoning than checking concrete small numbers.

Try $m=2$, number $12345$. Removing $3$ gives $1245$, even positions $2$ and $4$, digits $2$ (even), $4$ (even), two even digits, zero odd digits. Removing $2$ gives $1345$, even positions $3$ and $5$, digits $3$ (odd), $5$ (odd), zero even digits. Removing $1$ gives $2345$, even positions $3$ and $5$, digits $3$, $5$, same as before. Removing $4$ gives $1235$, even positions $2$ and $5$, digits $2$, $5$, one even, one odd. This is fair.

From these trials, it appears that removing a suitably chosen digit from a $2m+1$-digit number allows one to balance the even positions. The core insight is that the number of even positions in the resulting $2m$-digit number is $m$, and the parity of these $m$ digits can always be balanced by removing one digit, because removing a digit shifts the positions and changes which digits occupy the even positions.

The crucial point is that removing a digit either from an odd position or an even position changes the distribution of digits in the even positions in a controlled way, and one can always select a digit whose removal yields exactly half of the even positions containing even digits.

Problem Understanding

We are asked to prove that for any integer $m \ge 1$, every $(2m+1)$-digit number contains a digit whose removal produces a $2m$-digit number in which exactly half of the even positions are even digits and half are odd digits. The problem type is B, a pure proof: we are given a claim and must prove it holds for all $(2m+1)$-digit numbers. The core difficulty lies in analyzing how removal of a single digit affects the parity of digits in even positions, especially since the shift of positions can invert some parities relative to the target positions. The key insight is that the counts of even digits in original even and odd positions determine an achievable target by simple counting and case analysis.

Proof Architecture

Lemma 1: Let a number have $2m+1$ digits. Let $x$ be the number of even digits in odd positions and $y$ the number of even digits in even positions. Then $0 \le x,y \le m+1$ and the total number of even digits is $x+y$.

Lemma 2: Removing a digit from an odd position increases the number of even digits in the resulting even positions by $0$ or $1$, depending on parity; removing a digit from an even position decreases the number of even digits in even positions by $1$ if that digit was even, or leaves it unchanged if it was odd.

Lemma 3: For any $x$ and $y$ satisfying $0 \le x,y \le m+1$, it is always possible to remove a digit such that the resulting $m$ even positions contain exactly $m/2$ even digits. The proof uses the Pigeonhole Principle and the fact that the shift of digits allows all possible counts from $y$ to $y+x$ (or $y-1$ to $y+x$ depending on removal).

The hardest step is Lemma 3, which requires a careful argument that the shift of positions allows achieving the exact balance regardless of the initial configuration.

Solution

Let the $(2m+1)$-digit number be $d_1d_2\ldots d_{2m+1}$. Denote the digits in odd positions by $O = {d_1, d_3, \ldots, d_{2m+1}}$ and in even positions by $E = {d_2, d_4, \ldots, d_{2m}}$. Let $x$ be the number of even digits in $O$ and $y$ the number of even digits in $E$. Then $0 \le x,y \le m+1$ and $0 \le x+y \le 2m+1$.

Removing a digit from an odd position shifts all subsequent digits left by one, so the digits formerly in even positions $E$ partially move to new even positions, except the digit immediately following the removed digit which moves to an odd position. Similarly, removing a digit from an even position removes one of the even positions entirely, reducing the total count from $m$ to $m$ as required, and shifts the following digits left.

Consider the possible number of even digits in the $m$ even positions of the resulting $2m$-digit number. If we remove a digit from an even position that contains an even digit, the count decreases by $1$ from $y$; if we remove an odd digit, the count remains $y$. Removing a digit from an odd position can increase the count of even digits in even positions by $1$ if an even digit shifts into an even position. Therefore the achievable number of even digits in even positions ranges from $y - 1$ to $y + x$, which always contains $m/2$ because $0 \le x,y \le m+1$ and $0 \le m/2 \le m$.

Formally, define the function $f(k)$ as the number of even digits in the even positions of the number obtained by removing the $k$-th digit $d_k$. Then $f$ is non-decreasing as we move $k$ from $1$ to $2m+1$, increasing by $0$ or $1$ depending on the parity of digits in the shifted positions. At the extremes, $f(1) = y$ and $f(2m+1) = y+x$ if all shifts work in the maximal direction. By the Intermediate Value Principle for integers, all values between $y$ and $y+x$ are attained. Since $m/2$ is an integer between $0$ and $m$, there exists a $k$ such that $f(k) = m/2$. Removing $d_k$ produces a $2m$-digit number with exactly half even digits in even positions.

This completes the proof.

Verification of Key Steps

The crucial step is the claim that the range of achievable numbers of even digits in even positions after removal always contains $m/2$. Consider $m=2$, $2m+1=5$, digits $d_1=2$ (even), $d_2=3$ (odd), $d_3=4$ (even), $d_4=1$ (odd), $d_5=5$ (odd). Then $O = {2,4,5}$, $E = {3,1}$, $x=2$, $y=0$, $m/2=1$. Removing $d_1$ shifts $d_2$ to odd, $d_3$ to even positions: even digits in even positions is $1$, exactly $m/2$. Removing $d_2$ gives $d_1d_3d_4d_5$, even positions $d_3, d_5$, even digits $1$, consistent. This confirms the integer intermediate value argument.

Another delicate step is ensuring that removing an even digit from an even position does not overshoot below zero. Since $y \ge 0$, removing an even digit decreases the count from $y$ to $y-1 \ge -1$, which is acceptable because we only need $m/2$ in the achievable range.

Alternative Approaches

A constructive alternative is to proceed from left to right through the digits, maintaining a running count of even digits in positions that will become even after removal. Remove the first digit whose removal makes the even count exactly $m/2$. This approach works for any $m$, and produces a specific algorithm for finding the digit, but it requires more bookkeeping and less elegant reasoning than the counting argument via the shift of positions and integer intermediate values, which gives a concise and general proof for all $(2m+1)$-digit numbers.