Prove that if $p$ is a prime and $a$ and $b$ are nonzero integers such that $a\equiv b$ (mod $p^2-p$), then $a^a \equiv b^b$ (mod $p$) Prove that if $p$ is a prime and $a$ and $b$ are nonzero integers such that $a\equiv b$ (mod $p^2-p$), then $a^a \equiv b^b$ (mod $p$). I know
$$p^2-p \vert (a-b)\iff p(p-1) \vert (a-b) \iff p \vert \frac{a-b}{p-1}$$
I don't know any more though. A hint would be much appreciated.
 A: Hint: $a\equiv b \bmod p^2-p$ implies $a\equiv b \bmod p$  and $a\equiv b \bmod p-1$. Also, $m\equiv n \bmod p-1$ implies $a^m \equiv b^n \bmod p$.
A: We know $p(p-1)|a - b$ so $a \equiv b \mod p$ and $a\equiv b \mod p-1$.
So if $p|a$ this is trivial $a \equiv b \equiv 0 \mod p$ so $a^k \equiv b^j \equiv 0 \mod p$.
If $\gcd(a,p)=1$ then $\gcd(a,p) = 1$.  By Fermat's little Theorem.  $a^{p-1} \equiv 1\mod p$.
Now $a\equiv b \mod p-1$ so $b = a + k(p-1)$ for some integer $k$.
So  $b^b \equiv a^b \equiv a^{a + k(p-1)} \equiv a^a*(a^{p-1})^k \equiv a^a\mod p$.
A: Whatever the approach, everything here boils down to the Chinese remainder theorem and Fermat's little theorem. By the CRT, the initial congruence is equivalent to $a \equiv b$ mod $p$ and $a \equiv b$ mod $(p-1)$. Since the question is obvious if $a \equiv b \equiv 0$ mod $p$, we can assume $\bar a = \bar b$ in $(\mathbf Z/p)^*$ (with obvious notations), so that the desired result is equivalent to ${\bar a}^{a-b}=\bar 1$ in $(\mathbf Z/p)^*$. But $a \equiv b$ mod $(p-1)$, and FLT allows to conclude.
