Given $f(n)$ how to find the maximum value of $f(n^5)$? A friend of mine recently asked me this question.
For a positive integer $n$, a function $f(n)$ is defined as:
$f(n)=$ sum of digits in $n$.
given $f(n)=5$ find the maximum value of $f(n^5)$.
I tried solving this problem by putting random values, but my friend gave me a hint that the answer is greater than 100. Now I am completely lost because I couldn't find a single $n$ for which the value of $f(n^5)$ comes out to be greater than 100. Is there a proper way to solve it?
 A: $f(xy) \le f(x) f(y)$, with equality only if there are no carries in the long multiplication of $x$ and $y$.  So $f(n^5) \le f(n)^5 = 5^5$, with equality only if there are no carries.  Well, you can't quite get away with no carries because ${5 \choose 2} = {5 \choose 3} = 10$, but you can try to reduce them.
For example, 
$f(1 + 10^2 + 10^{12} + 10^{62} + 10^{216}) = 5$ and $f((1 + 10^2 + 10^{12} + 10^{62} + 10^{216})^5) = 398$
I think this is the best possible.
A: Consider the terms generated by $(a+b+c+d+e)^5$. There will be $5$ of the form $a^5$ which will have a coeffiecient of $1$ & each will therefore give a contribution of $1$,  there will be $20$ of the form $a^4 b$ which will have a coeffiecient of $5$ & will therefore give a contribution of $5$, etc ... terms whose coefficients are a multiple of $10$ will only give that multiple. The following table summarises the possible contributions
\begin{eqnarray*}
\begin{array}{|c|c|c|c|c|}
\hline
form & multiplicity &  coefficient & contribution & tot \\ \hline
 a^5 & 5 & 1 & 1 & 5 \\ \hline
 a^4b & 20 & 5 & 5 & 100 \\ \hline
 a^3b^2 & 20 & 10 & 1 & 20 \\ \hline
 a^3bc & 30 & 20 & 2 & 60 \\ \hline
 a^2b^2c & 30 & 30 & 3 & 90 \\ \hline
 a^2bcd & 20 & 60 & 6 & 120 \\ \hline
 abcde & 1 & 120 & 3 & 3 \\ \hline
\end{array}
\end{eqnarray*}
Totting up the tot ... we make the best $f(n^5)=\color{red}{398}$.
