Maths Olympiad Prep

Library / IMO Hk TST /69 of 119

IMO Hk TST

Combinatorics Difficulty 8.0 Shortlist Prove it Hong Kong

For any positive integer nn, define f(n)f(n) as the sum of the squares of the digits of nn (in base ten). For example, f(2012)=22+02+12+22=9f(2012) = 2^2 + 0^2 + 1^2 + 2^2 = 9. Find the greatest integer nn such that there exists a positive integer dd with f(f(⋯f(n)⋯ )⏟d times)=nf(\underbrace{f(\cdots f(n)\cdots)}_{d \text{ times}}) = n.

Solution

The greatest nn is 145145.

One can easily check that
145↦42↦20↦4↦16↦37↦58↦89↦145, 145 \mapsto 42 \mapsto 20 \mapsto 4 \mapsto 16 \mapsto 37 \mapsto 58 \mapsto 89 \mapsto 145,
so that f8(145)=145f^8(145) = 145. It remains to check n≤145n \le 145.

We first prove that nn has at most 33 digits. Suppose on the contrary that n=a1a2⋯ak‾n = \overline{a_1a_2\cdots a_k} where k≥4k \ge 4. For any m≤nm \le n, we have
f(m)≤f(99⋯9⏟k times)=81k<10k−1≤n. f(m) \le f(\underbrace{99\cdots9}_{k \text{ times}}) = 81k < 10^{k-1} \le n.
(To prove 81k<10k−181k < 10^{k-1} for k≥4k \ge 4, we check the base case 324<1000324 < 1000 and the inductive step 81(k+1)<10(81k)<10k81(k+1) < 10(81k) < 10^k.) Using this, we can easily prove that fs(n)<nf^s(n) < n for any s∈Z+s \in \mathbb{Z}^+. Thus, it is impossible that fs(n)=nf^s(n) = n.

Similarly, if n>243n > 243, then for m≤nm \le n, we have
f(m)≤f(999)=243<n. f(m) \le f(999) = 243 < n.
If 163<n≤243163 < n \le 243, then for m≤nm \le n, we have
f(m)≤f(199)=163<n. f(m) \le f(199) = 163 < n.
Thus, we must have n≤163n \le 163.

Note that nn is also the image of some term in the cycle. Let n=f(t)n = f(t) for some t≤163t \le 163. If n>145=82+92n > 145 = 8^2 + 9^2, then the only possibility is t=99t = 99. But then we have
99↦162↦41↦17↦50↦25↦29↦85↦89↦145, 99 \mapsto 162 \mapsto 41 \mapsto 17 \mapsto 50 \mapsto 25 \mapsto 29 \mapsto 85 \mapsto 89 \mapsto 145,
which enters the cycle with largest term 145145, and so it never goes back to 162162. Therefore, we must have n≤145n \le 145. This completes the proof.

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 reproduced verbatim; metadata (topic, difficulty) added by this project.