TITLE: Proving that $n$ and $m$ divides $1^{n}+2^{n}+3^{n}+\cdots+m^{n}$
QUESTION [7 upvotes]: For which positive integers $m, n$ is true that the number $$1^{n}+2^{n}+3^{n}+\cdots+m^{n}$$ is divisible by $n$ and $m$?

REPLY [2 votes]: Here is some partial progress. If $n$ is square-free we can reduce your question to the following:
When do positive integers $n$ and $m$, with $n$ square-free, both divide $1+ 2 + \cdots + m = \frac{m(m+1)}{2}$?
Let's start with the question of when a square-free positive integer $n$ divides the sum $1^n + 2^n + \cdots + m^n$. Factoring $n$ into primes, say we have $n = p_1\cdots p_r$, where the $p_i$ are distinct by hypothesis. Using the corollary to Fermat's Little Theorem we have $k^{p_i} \equiv k \ (\text{mod} \ p_i)$ for each $1 \le k \le m$ and for each prime $p_i$ dividing $n$. By repeated application of this we may conclude 
$1^n + 2^n + \cdots + m^n \equiv 1+ 2 + \cdots + m \ (\text{mod} \ n)$,
from which we obtain the question I stated first. A question for you: why does $n$ have to be square free for the above argument to work in general?
We can go further with this line of reasoning. First off, $m$ must be odd. This is because if $m$ divides $\frac{m(m+1)}{2}$ then we find that $m+1=2k$ for some integer $k$.
Again, let's say $n = p_1\cdots p_r$, where the $p_i$ are distinct primes (so $n$ is square-free). This gives us a system of congruences. Put $x = 1 + 2 + \cdots + m$, we wish to solve
$x \equiv 0 \ (\text{mod} \ p_i)$
simultaneously for each $i$. That is, we're solving for the prime numbers $p_i$, not for $x$. Let me remark, however, that if you fix a square free integer $n$, then the Chinese Remainder Theorem at least guarantees a solution, although it may not be terribly useful in finding those solutions.
Then by the above we can at least say $n$ is not even (again, provided we assume $n$ is square free). Moreover, we have a (trivial) upper bound on $n$. Namely if $n \neq \frac{m(m+1)}{2}$, then $n \le \frac{m(m+1)}{4}$.