TITLE: Why can't $p^p-(p-1)^{p-1}=n^2$ be a square?
QUESTION [15 upvotes]: Let $p$ be a prime number. Show that $p^p-(p-1)^{p-1}$ can't be a square.
In other words, there is no $n\in\mathbb{N}^{+}$ such that
$$p^p-(p-1)^{p-1}=n^2.$$

REPLY [15 votes]: Let $p=2m+1$. Then $p^p=((p-1)^m+ni)((p-1)^m-ni)$. Now, the prime factorization in the Gaussian integers is unique and no factor on the right is divisible by $p$, so the only logically possible case is $p=4k+1=x^2+y^2$ and $(p-1)^m+ni=(x+iy)^p$. Then $1\equiv (p-1)^m\equiv x^p\equiv x\mod p$, so $x=1$. However, in this case the real part on the LHS is divisible by $y$ and the real part on the RHS is congruent to $1$ modulo $y$, which is a clear contradiction.