Given a positive base-10 positive integer \(N=a_na_{n-1}\ldots a_1a_0\), let \(f(N)=2^na_0+2^{n-1}a_1+\cdots+2^1a_{n-1}+2^0a_n\). Find \(f(f(\ldots f(2014^{2014})\ldots))\) (\(2014^{2014}\) applications of \(f\)).
Solution
Answer: \(19\)
For positive \(N\), \(f(N)>0\). If \(N\geq100\), its highest digit index satisfies \(n\geq2\), and \(f(N)\leq9(2^n+2^{n-1}+\cdots+1)<9\cdot2^{n+1}<10^n\leq N\).
If \(20\leq N<100\), write \(N=10a_1+a_0\), with \(a_1\geq2\). Then \(f(N)=2a_0+a_1<10a_1+a_0=N\). Repeated applications therefore decrease the value until it is between \(1\) and \(19\).
Also, if \(19\mid N\), then \(19\mid f(N)\). Indeed, using \(20\equiv1\pmod{19}\),
\[10^nf(N)=\sum_{j=0}^{n}10^n2^{n-j}a_j\equiv\sum_{j=0}^{n}10^ja_j=N\pmod{19}.\]
Since \(2014=19\cdot106\), the starting value is divisible by \(19\), and every iterate remains divisible by \(19\). The only such positive value at most \(19\) is \(19\), which is fixed by \(f\).