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.