“Last Fermat's Theorem” modulo m

The last Fermat's Theorem is a claim about the non-existence of non-trivial integer solution for $X^n+Y^n=Z^n$ for $n\in \mathbb N$, $n\ge 3$.

However, given $m\in \mathbb N$, we can investigate the integer solutions for $X^n+Y^n\equiv Z^n \mod m$ for all $n\in \mathbb N$ with the restriciton that $X,Y,Z\not\equiv0\mod m$.

It seems to me that we always have solutions in this case, but I did no find any reference or exposition about this.

Is it "relevant" to think on it? Have this question appeared elsewhere?

• Just as an initial comment, I would observe that it's immediately trivially true unless we restrict $X, Y, Z \not\equiv 0 \pmod{m}$. – Brian Tung Nov 5 '15 at 23:10
• Sure, I will include this note! It is "analogous" to the condition of the Theorem... – Binai Nov 5 '15 at 23:16
• It works if you take $X=1$, $Y=1$, $Z=2$, and $n = \lambda(m)+1$, where $\lambda$ is the Carmichael function. Maybe it is more interesting to require $n \le \lambda(m)$? – Dan Brumleve Nov 5 '15 at 23:24
• Why? How do you eliminate the case where $n>\lambda(m)$? – Binai Nov 5 '15 at 23:30
• $X^{\lambda(m)+1} \equiv X \pmod{m}$. Since we always have solutions for $n=1$ we have solutions for $n=\lambda(m)+1$ too. – Dan Brumleve Nov 5 '15 at 23:42

You are correct. For sufficiently large primes $p$ and any $n \geq 1$, there are always nontrivial solutions to $$X^n + Y^n \equiv Z^n \pmod p.$$ Schur first proved this in 1916, in his paper --- Schur, I. "Über die Kongruenz x^m+y^m=z^m (mod p)." Jahresber. Deutsche Math.-Verein. 25, 114-116, 1916.
You might think it meta-wise clear that there are solutions mod $p$ for every $p$, as otherwise the problem wouldn't really be so hard. [Or perhaps you might think it's very hard to find a $p$ for which there are no solutions, and that was the bottleneck.]
As mixedmath says, this is true for sufficiently large prime $m$. This result is due to Schur. See this blog post for an exposition.