Find the largest $ n $ such that $ \frac{n^{2016} - 2n^{2015} + 3n^{2014} - \cdots + 2015n^2 - 2016n + 2017}{(2017 + n)} $ is an integer:
My attempt:
\begin{eqnarray*} & & n^{2016} - 2n^{2015} + 3n^{2014} - \cdots + 2015n^2 - 2016n + 2017 \\ &=& n^{2016}\left(1 - \frac{2}{n} + \frac{3}{n^2} - \cdots + \frac{2015}{n^{2014}} - \frac{2016}{n^{2015}} + \frac{2017}{n^{2016}}\right) \\ &= & n^{2016}\left(1 + 2\left(\frac{-1}{n}\right) + 3\left(\frac{-1}{n}\right)^2 + \cdots + 2015\left(\frac{-1}{n}\right)^{2014} + 2016\left(\frac{-1}{n}\right)^{2015} + 2017\left(\frac{-1}{n}\right)^{2016}\right) \\ \end{eqnarray*} Consider: \begin{eqnarray*} 1 + x + x^2 + x^3 + \cdots + x^{2017} &=& \frac{x^{2018} - 1}{x - 1} \\ 1 + 2x + 3x^2 + \cdots + 2017x^{2016} &=& \frac{(x - 1)2018x^{2017} - (x^{2018} - 1)}{(x - 1)^2} \\ &=& \frac{2018x^{2018} - 2018x^{2017} - x^{2018} + 1}{(x - 1)^2} \\ &=& \frac{2017x^{2018} - 2018x^{2017} + 1}{(x - 1)^2} \\ \end{eqnarray*} Put $ x = \frac{-1}{n} $, we get \begin{eqnarray*} 1 + 2x + 3x^2 + \cdots + 2017x^{2016} &=& \frac{2017x^{2018} - 2018x^{2017} + 1}{(x - 1)^2} \\ 1 + 2\left(\frac{-1}{n}\right) + 3\left(\frac{-1}{n}\right)^2 + \cdots + 2017\left(\frac{-1}{n}\right)^{2016} &=& \frac{2017\left(\frac{-1}{n}\right)^{2018} - 2018\left(\frac{-1}{n}\right)^{2017} + 1}{(\left(\frac{-1}{n}\right) - 1)^2} \\ n^{2016}\left(1 + 2\left(\frac{-1}{n}\right) + 3\left(\frac{-1}{n}\right)^2 + \cdots + 2017\left(\frac{-1}{n}\right)^{2016} \right) &=& n^{2016}\left(\frac{2017\left(\frac{-1}{n}\right)^{2018} - 2018\left(\frac{-1}{n}\right)^{2017} + 1}{(\left(\frac{-1}{n}\right) - 1)^2}\right) \\ \end{eqnarray*}Now focus on the right hand side, simplifying \begin{eqnarray*} & & n^{2016}\left(\frac{2017\left(\frac{-1}{n}\right)^{2018} - 2018\left(\frac{-1}{n}\right)^{2017} + 1}{(\left(\frac{-1}{n}\right) - 1)^2}\right) \\ &=& n^{2016}\left(\frac{2017\left(\frac{1}{n}\right)^{2018} + 2018\left(\frac{1}{n}\right)^{2017} + 1}{(\left(\frac{1}{n}\right) + 1)^2}\right) \\ &=& \frac{2017\left(\frac{1}{n^2}\right) + 2018\left(\frac{1}{n}\right) + n^{2016}}{(\left(\frac{1}{n}\right) + 1)^2} \\ &=& \frac{2017 + 2018n + n^{2018}}{(n + 1)^2} \\ &=& \frac{2017 + n + 2017n + n^{2018}}{(n + 1)^2} \\ \end{eqnarray*}
Feel like and Fermat's theorem, but not sure how to move forward from there.