Maths Olympiad Prep

Library / /83 of 136

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
1454220416375889145, 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 n145n \le 145.

We first prove that nn has at most 33 digits. Suppose on the contrary that n=a1a2akn = \overline{a_1a_2\cdots a_k} where k4k \ge 4. For any mnm \le n, we have
f(m)f(999k times)=81k<10k1n. f(m) \le f(\underbrace{99\cdots9}_{k \text{ times}}) = 81k < 10^{k-1} \le n.
(To prove 81k<10k181k < 10^{k-1} for k4k \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 sZ+s \in \mathbb{Z}^+. Thus, it is impossible that fs(n)=nf^s(n) = n.

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

Note that nn is also the image of some term in the cycle. Let n=f(t)n = f(t) for some t163t \le 163. If n>145=82+92n > 145 = 8^2 + 9^2, then the only possibility is t=99t = 99. But then we have
9916241175025298589145, 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 n145n \le 145. This completes the proof.

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