Maths Olympiad Prep

Library / /232 of 397

, 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 an1an2a0\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++an12<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 10n1k<10n10^{n-1} \le k < 10^n, we know 102n2k2<102n10^{2n-2} \le k^2 < 10^{2n}, hence k2k^2 has either 2n12n-1 digits or 2n2n digits.

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

Value of an1=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 an1210\lfloor \frac{a_{n-1}^2}{10} \rfloor and (an1+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 2n12n-1 digits.

Step 2. For 0m<n0 \le m < n define cm=i=0maiamic_m = \sum_{i=0}^{m} a_i a_{m-i}. Then, from the condition that kk is a palindrome we know
k2=cn110n1+i=0n2(10i+102n2i). 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,,bn1b_0, b_1, \dots, b_{n-1} between 0 and 9 such that
k2=bn110n1+i=0n2bi(10i+102n2i). 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,,cn1c_0, c_1, \dots, c_{n-1} be nonnegative integers, and let b0,b1,,bn1b_0, b_1, \dots, b_{n-1} be integers between 0 and 9. If
cn110n1+i=0n2(10i+102n2i)=bn110n1+i=0n2bi(10i+102n2i),(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 0i<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 n1n-1. Taking both sides of (1) modulo 1010 gives
c0b0(mod10). c_0 \equiv b_0 \pmod{10}.
So we may write c0=b0+10tc_0 = b_0 + 10t. Since 0b090 \le b_0 \le 9 and c00c_0 \ge 0, we get t0t \ge 0, hence c0b0c_0 \ge b_0.

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

Cancelling the term c0(1+102n2)c_0(1 + 10^{2n-2}) from both sides of (1) and dividing both sides by 1010, we get
cn110n2+i=1n2(10i1+102n3i)=bn110n2+i=1n2bi(10i1+102n3i).(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 1i<n1 \le i < n, which completes the proof by mathematical induction.

Returning to the original proof. By the lemma we know
i=0n1aian1i=cn1=bn1<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 an1i=aia_{n-1-i} = a_i, hence we obtain i=0n1ai2<10\sum_{i=0}^{n-1} a_i^2 < 10.

(\Leftarrow) Again let cm=i=0maiamic_m = \sum_{i=0}^{m} a_i a_{m-i}. From the condition that kk is a palindrome we have
k2=cn110n1+i=0n2ci(10i+102n2i). 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=c0c1cn2cn1cn2c1c0k^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=0maiamii=0mai2+ami22(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,000 problems in a working order, from AMC 10 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.