First consider

In this case we have: odd, thus is odd.

The case is trivial, so consider

Let this turns out to be the smallest prime dividing

Now:

Let because of and we also have (by Fermat's Little Theorem)

Thus and note that: that is and using Euclid's Lemma we get:

If we had: , contradicting

Now since it follows that we have

If then and expand by using the Binomial Theorem: and note that for all thus but note that thus thus and we get the solution

If we find that hence this generates no solutions.

Now it only remains to check what happens when , here we have and so or .

Thus the solutions are