<s>[INST] Theorem related to Fermat's last Theorem I have found that the following is true, so no need for verification anymore.
Identity:
$ \quad \quad \quad \quad (ax + b)^n \equiv b^n + rx \pmod {x^2} \iff r = nab^{n - 1} \pmod x$
We can prove this by induction on n.
Theorem:
Let:
$ \quad \quad \quad \quad p$ be a prime and $k \gt 0$
$ \quad \quad \quad \quad p^k | x - y$
$ \quad \quad \quad \quad p^{k + 1} \not | x - y$
$ \quad \quad \quad \quad gcd(x,y,z) = 1$
$ \quad \quad \quad \quad n \gt 2$
$ \quad \quad \quad \quad x^n = y^n + z^n$
Then:
$ \quad \quad \quad \quad p | n$ if and only if $n \not | k$
Proof:
Let us set $x = p^k$ in our identity which gives us:
$ \quad \quad \quad \quad (ap^k + b)^n \equiv b^n + rp^k \pmod {p^{2k}} \iff r \equiv nab^{n - 1} \pmod {p^k}$
Now let:
$ \quad \quad \quad \quad x = ap^k + b$,
$ \quad \quad \quad \quad y = b$.
Then we have:
$ \quad \quad \quad \quad p^t | z$, for $t = \lceil k/n \rceil$ so: $z = sp^t$ for some $s$.
Looking at our identity we get:
$ \quad \quad \quad \quad (ap^k + b)^n \equiv b^n + rp^k \equiv y^n + z^n \pmod {p^{2k}}$
$ \quad \quad \quad \quad \iff z^n = rp^k + up^{2k}$ for some $u$.
$ \quad \quad \quad \quad \iff (sp^t)^n = p^k(r + up^k)$
$ \quad \quad \quad \quad \iff s^np^{tn - k} = r + up^k$
We see $p | r$ if and only if $tn \not = k$, so:
$ \quad \quad \quad \quad r \equiv nab^{n - 1} \pmod p$
But we have:
$ \quad \quad \quad \quad a = (x - y)/p^k$ and so $a \not \equiv 0 \pmod p$, because of $p^{k + 1} \not | x - y$,
and:
$ \quad \quad \quad \quad b \not \equiv 0 \pmod p$, otherwise we would have $gcd(x,y,z) \gt 1$,
so it is clear that $p | n$ if and only if $n \not | k$ and this proves our theorem.
 [/INST] Here's one immediate mistake: if $k=0$ (that is, if $p$ does not divide $x-y$) then everything breaks down, since any two numbers are equivalent mod $p^k=1$.
</s>