Editorial for A Square Problem
Submitting an official solution before solving the problem yourself is a bannable offence.
Note that is a difference of squares. This means it can be rewritten as .
From this, it can be proven that is only prime when and is a prime.
Thus, we can check if is prime to determine if is prime. To check if is prime, we can check if it is divisible by any numbers less than its square root. The proof is left as an exercise for the reader.