Why can primes of the form 4k − 1 not be written as sums of two squares?
In number theory, the property regarding the sum of two squares is specifically associated with primes of the form . Pierre de Fermat famously observed that every prime of the form can be uniquely expressed as the sum of two squares, a result later proven by Leonhard Euler.31
Primes of the form (which are equivalent to ) cannot be written as the sum of two squares because of the constraints of modular arithmetic. Specifically, any square of an integer is congruent to either 0 or 1 modulo 4. Consequently, the sum of two squares can only be congruent to 0, 1, or 2 modulo 4. A prime of the form is congruent to 3 modulo 4, which is impossible to achieve by adding two squares under these conditions.2
While these primes cannot be expressed as the sum of two squares, Lagrange’s four-square theorem establishes that every positive integer, including these primes, can be expressed as the sum of four or fewer squares.31