Maths Olympiad Prep

Library / Taiwan IMO Selection Camp /213 of 359

Taiwan IMO Selection Camp, 2022

Algebra Difficulty 6.1 National Olympiad Prove it Taiwan

A positive integer is called a palindrome if and only if it reads the same from left to right as from right to left, for example 12211221 or 7484774847 are both palindromes. An nn-digit positive integer kk is written in base ten as an−1an−2⋯a0‾\overline{a_{n-1}a_{n-2}\cdots a_0}. Prove that if kk is a palindrome, then k2k^2 is a palindrome if and only if a02+a12+⋯+an−12<10a_0^2 + a_1^2 + \cdots + a_{n-1}^2 < 10.

Solution

(⇒\Rightarrow) Step 1. We use exhaustive case analysis to discuss the leading digit and the last digit of k2k^2. First, since 10n−1≤k<10n10^{n-1} \le k < 10^n, we know 102n−2≤k2<102n10^{2n-2} \le k^2 < 10^{2n}, hence k2k^2 has either 2n−12n-1 digits or 2n2n digits.

If k2k^2 has 2n2n digits, then by exhaustive enumeration we obtain the following table:

Value of an−1=a0a_{n-1} = a_0Possible leading digit(s) of k2k^2Last digit of k2k^2
319
41, 26
52, 35
63, 46
74, 5, 69
86, 7, 84
98, 91

Here the possible leading digit(s) of k2k^2 are the positive integers lying between ⌊an−1210⌋\lfloor \frac{a_{n-1}^2}{10} \rfloor and ⌊(an−1+1)210⌋\lfloor \frac{(a_{n-1}+1)^2}{10} \rfloor. From the table above, we see that if k2k^2 has 2n2n digits, then k2k^2 cannot be a palindrome. Hence if k2k^2 is a palindrome, then k2k^2 must have 2n−12n-1 digits.

Step 2. For 0≤m<n0 \le m < n define cm=∑i=0maiam−ic_m = \sum_{i=0}^{m} a_i a_{m-i}. Then, from the condition that kk is a palindrome we know
k2=cn−1⋅10n−1+∑i=0n−2(10i+102n−2−i). k^2 = c_{n-1} \cdot 10^{n-1} + \sum_{i=0}^{n-2} (10^i + 10^{2n-2-i}).
And since k2k^2 is also a palindrome, we may assume there exist integers b0,b1,…,bn−1b_0, b_1, \dots, b_{n-1} between 0 and 9 such that
k2=bn−1⋅10n−1+∑i=0n−2bi(10i+102n−2−i). k^2 = b_{n-1} \cdot 10^{n-1} + \sum_{i=0}^{n-2} b_i (10^i + 10^{2n-2-i}).
We prove the following lemma.

Lemma. Let nn be a positive integer, let c0,c1,…,cn−1c_0, c_1, \dots, c_{n-1} be nonnegative integers, and let b0,b1,…,bn−1b_0, b_1, \dots, b_{n-1} be integers between 0 and 9. If
cn−1⋅10n−1+∑i=0n−2(10i+102n−2−i)=bn−1⋅10n−1+∑i=0n−2bi(10i+102n−2−i),(1) c_{n-1} \cdot 10^{n-1} + \sum_{i=0}^{n-2} (10^i + 10^{2n-2-i}) = b_{n-1} \cdot 10^{n-1} + \sum_{i=0}^{n-2} b_i (10^i + 10^{2n-2-i}), \quad (1)
then bi=cib_i = c_i for all 0≤i<n0 \le i < n.

Proof of Lemma. We induct on nn. When n=1n=1 the claim is obvious. Now assume the claim holds for n−1n-1. Taking both sides of (1) modulo 1010 gives
c0≡b0(mod10). c_0 \equiv b_0 \pmod{10}.
So we may write c0=b0+10tc_0 = b_0 + 10t. Since 0≤b0≤90 \le b_0 \le 9 and c0≥0c_0 \ge 0, we get t≥0t \ge 0, hence c0≥b0c_0 \ge b_0.

On the other hand, observing (1) again, we have
c0(1+102n−2)≤LHS=RHS<(b0+1)(1+102n−2), c_0(1 + 10^{2n-2}) \le \text{LHS} = \text{RHS} < (b_0 + 1)(1 + 10^{2n-2}),
so c0≤b0c_0 \le b_0. Therefore c0=b0c_0 = b_0.

Cancelling the term c0(1+102n−2)c_0(1 + 10^{2n-2}) from both sides of (1) and dividing both sides by 1010, we get
cn−1⋅10n−2+∑i=1n−2(10i−1+102n−3−i)=bn−1⋅10n−2+∑i=1n−2bi(10i−1+102n−3−i).(2) c_{n-1} \cdot 10^{n-2} + \sum_{i=1}^{n-2} (10^{i-1} + 10^{2n-3-i}) = b_{n-1} \cdot 10^{n-2} + \sum_{i=1}^{n-2} b_i (10^{i-1} + 10^{2n-3-i}). \quad (2)
We find that (2) allows us to apply the induction hypothesis to obtain bi=cib_i = c_i for 1≤i<n1 \le i < n, which completes the proof by mathematical induction.

Returning to the original proof. By the lemma we know
∑i=0n−1aian−1−i=cn−1=bn−1<10, \sum_{i=0}^{n-1} a_i a_{n-1-i} = c_{n-1} = b_{n-1} < 10,
and since kk is a palindrome we know an−1−i=aia_{n-1-i} = a_i, hence we obtain ∑i=0n−1ai2<10\sum_{i=0}^{n-1} a_i^2 < 10.

(⇐\Leftarrow) Again let cm=∑i=0maiam−ic_m = \sum_{i=0}^{m} a_i a_{m-i}. From the condition that kk is a palindrome we have
k2=cn−1⋅10n−1+∑i=0n−2ci(10i+102n−2−i). k^2 = c_{n-1} \cdot 10^{n-1} + \sum_{i=0}^{n-2} c_i (10^i + 10^{2n-2-i}).
Here it suffices to prove that cm<10c_m < 10 for m<nm < n. In this way, k2=c0c1⋯cn−2cn−1cn−2⋯c1c0‾k^2 = \overline{c_0c_1\cdots c_{n-2}c_{n-1}c_{n-2}\cdots c_1c_0} is a palindrome. For m<nm < n, we have
cm=∑i=0maiam−i≤∑i=0mai2+am−i22(by AM-GM)=∑i=0mai2<10. \begin{aligned} c_m &= \sum_{i=0}^{m} a_i a_{m-i} \\ &\le \sum_{i=0}^{m} \frac{a_i^2 + a_{m-i}^2}{2} \quad (\text{by AM-GM}) \\ &= \sum_{i=0}^{m} a_i^2 < 10. \end{aligned}

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement translated into English from zh; metadata (topic, difficulty) added by this project.