# Find the largest integer $p$ such that $p+2013$ perfectly divides $[(p^{2013})+(p^{2012})+ … +(p^2)+p+1]$

Find the largest integer $p$ such that $p+2013$ perfectly divides $[(p^{2013})+(p^{2012})+ .... +(p^2)+p+1]$

My approach:

Remainder when $p^{2012} + p^{2011} + \ldots + p + 1$ is divided by $p + 2012$ is $R = 2012^{2012} - 2012^{2011} + 2012^{2010} - \ldots - 2012 + 1$. This should be divisible by $p + 2012$. So maximum value of $p$ will be $R - 2012$ $$\max p = {(2012^{2013} + 1)/2013} - 2012.$$

-
Too many mismatches (in Question Title vs Body) to start thinking :-( Check the range of exponents for starters. Does it go up to 2012 or 2013???? Same thing about the divisor. Which is it? – Jyrki Lahtonen Jul 2 '12 at 11:39
Once you've decided what the question is, you can sum the geometric series and then check $p=1$, $p=2$, $p=3$, etc., until you find one that doesn't work. – Gerry Myerson Jul 2 '12 at 12:09

The solution below is very close to the solution described in the post. It seems useful to describe what's going on in terms of polynomial division.

For brevity, and increased generality, let $a=2013$, and let $n=2013$. Consider the polynomial $$P(x)=x^n+x^{n-1}+x^{n-2}+\cdots+x+1.$$ Divide $P(x)$ by the monic polynomial $x+a$. So we have $P(x)=Q(x)(x+a)+r$, where $Q(x)$ has integer coefficients. Putting $x=-a$ we conclude that $r=P(-a)$.

It so happens that $P(-a)$ is negative, so it is convenient to let $K=-P(-a)$. Thus $$\frac{P(x)}{x+a}=Q(x)-\frac{K}{x+a}.$$ It follows that for any integer $x$, the number $x+a$ divides $P(x)$ iff $x+a$ divides $K$.

We want the largest $x$ such that $x+a$ divides $K$. This is $K-a$. We can describe $K$ in various ways, not very compactly as $a^{n}-a^{n-1}+\cdots +a^2-a+1$, and more compactly by summing the geometric series.

-

Let q=p+2013, $\sum{_{0≤r≤2013}(p^r)}=\sum{_{0≤r≤2013}(q-2013)^r}≡\sum{_{0≤r≤2013}(-2013)^r}(mod\ q)$ as $(a-b)^n≡(-b)^n(mod\ a)$

So, q(=p+2013) must divide $\sum{_{0≤r≤2013}(-2013)^r}=\frac{(-2013)^{2014}-1}{(-2013-1)}$

-