TITLE: Finding highest power
QUESTION [5 upvotes]: Find the highest power of 2017 which divides $2016^{{2017}^{2018}}+2018^{{2017}^{2016}}+2017^{{2016}^{2018}}$
I know how to do these types of problems if factorial is given using greatest integer function but how do you do this problem? Should I use modulo operations?

REPLY [4 votes]: Let $v_{2017}(n)$ be the highest power of $2017$ that divides $n$.
(Note that $2017$ is prime.)
A useful theorem is lifting the exponent:

If $p$ is an odd prime, $p \mid x+y$, $p \nmid xy$, then $v_p(x^n - y^n) = v_p(x-y) + v_p(n)$.
If $p$ is an odd prime and $n$ is odd, $p \mid x+y$, $p \nmid xy$, then $v_p(x^n + y^n) = v_p(x+y) + v_p(n)$.

There is a similar statement for $p=2$, but it will not be relevant here.

$$\begin{array}{cl}
& v_{2017}\left( 2016^{{2017}^{2018}} + 1 \right) \\
=& v_{2017}\left( 2016^{{2017}^{2018}} + 1^{{2017}^{2018}} \right) \\
=& v_{2017}\left( 2016 + 1 \right) + v_{2017}({2017}^{2018}) \\
=& 1 + 2018 \\
=& 2019
\end{array}$$

$$\begin{array}{cl}
& v_{2017}\left( 2018^{{2017}^{2016}} - 1 \right) \\
=& v_{2017}\left( 2018^{{2017}^{2016}} - 1^{{2017}^{2016}} \right) \\
=& v_{2017}\left( 2018 - 1 \right) + v_{2017}({2017}^{2016}) \\
=& 1 + 2016 \\
=& 2017
\end{array}$$

And finally, $v_{2017}\left( 2017^{2016^{2018}} \right) = 2016^{2018}$.

Since the $v_{2017}$ of the three terms are not equal, the valuation of their sum is just the minimum, i.e. $2017$. In conclusion, $2017^{2017}$ is the highest power of $2017$ that divides your thing.