Prove that if $ p | x^p + y^p $ where $p$ is a prime number greater than $2$, then $p^2 | x^p + y^p$ I was trying to solve the following problem recently:

Prove that if $ p | x^p + y^p $ where $p$ is a prime number greater than $2$, then $p^2 | x^p + y^p$. Here $x$ and $y$ are both integers.

$a|b$ reads $a$ divides $b$ or $b$ is divisible by $a$.

I was able to solve the problem, but through arguably tedious means, my solutions is here.

I feel like there are more elegant solutions available, but I cannot think of any at present, which is why I decided to post this as a question here.

Thanks
Using Fermat's Little Theorem,

$$a^p\equiv a\pmod p$$ for any integer $a$

$$p|(x^p+y^p)\iff p\mid(x+y)$$

Let $x+y=kp$

For odd prime $p,$

$$x^p+y^p=x^p+(kp-x)^p=x^p-(x-kp)^p=\binom p1x^{p-1}\cdot kp+\text{ terms divisible by }p^2$$
$$\equiv0\pmod{p^2}$$
$p|x^p+y^p$ given

since $p$ is a prime number $&gt; 2$, it is an odd prime number

For any odd power $p$, $x^p+y^p$ has a factor $(x+y)$

Using Fermat's little theorem

$$x^p \equiv x \mod p\\
y^p \equiv  y\mod p\\
x^p+y^p \equiv (x+y) \equiv 0\mod p$$  since $p|x^p+y^p$

Therefore $p|(x+y)$, so $(x+y) = m*p$ where $m$ is an integer

$p|x^p+y^p$ and $(x+y)|x^p+y^p$

we can say $x^p+y^p = k*p*(x+y)$ where k is an integer
$=k*p*m*p = kmp^2$

So $x^p+y^p= kmp^2$ where $k$ and $m$ are integers.

so $p^2|x^p+y^p$

Proved