Pythagorean primes are exactly the odd prime numbers that are the sum of two squares; this characterization is Fermat's theorem on sums of two squares.
Equivalently, by the Pythagorean theorem, they are the odd prime numbers
is the length of the hypotenuse of a right triangle with integer legs, and they are also the prime numbers
itself is the hypotenuse of a primitive Pythagorean triangle.
For instance, the number 5 is a Pythagorean prime;
The first few Pythagorean primes are By Dirichlet's theorem on arithmetic progressions, this sequence is infinite.
, the numbers of Pythagorean and non-Pythagorean primes up to
is frequently somewhat smaller than the number of non-Pythagorean primes; this phenomenon is known as Chebyshev's bias.
up to 600000 for which there are more Pythagorean than non-Pythagorean odd primes less than or equal to n are 26861 and 26862.
[2] The sum of one odd square and one even square is congruent to 1 mod 4, but there exist composite numbers such as 21 that are 1 mod 4 and yet cannot be represented as sums of two squares.
Fermat's theorem on sums of two squares states that the prime numbers that can be represented as sums of two squares are exactly 2 and the odd primes congruent to 1 mod 4.
[3] The representation of each such number is unique, up to the ordering of the two squares.
[4] By using the Pythagorean theorem, this representation can be interpreted geometrically: the Pythagorean primes are exactly the odd prime numbers
such that there exists a right triangle, with integer legs, whose hypotenuse has length
such that there exists a right triangle with integer sides whose hypotenuse has length
[5] Another way to understand this representation as a sum of two squares involves Gaussian integers, the complex numbers whose real part and imaginary part are both integers.
Within the Gaussian integers, the Pythagorean primes are not considered to be prime numbers, because they can be factored as
The real and imaginary parts of the factors in these factorizations are the leg lengths of the right triangles having the given hypotenuses.
The law of quadratic reciprocity says that if
are distinct odd primes, at least one of which is Pythagorean, then
is a quadratic residue mod
is a quadratic residue mod
is a quadratic residue mod
is not a quadratic residue mod
a Pythagorean prime, the polynomial equation
is a quadratic residue mod
In contrast, this equation has no solution in the finite fields
vertices, representing the numbers modulo
, with two numbers adjacent in the graph if and only if their difference is a quadratic residue.
This definition produces the same adjacency relation regardless of the order in which the two numbers are subtracted to compute their difference, because of the property of Pythagorean primes that