Pythagorean prime

The Pythagorean prime 5 and its square root are both hypotenuses of right triangles with integer legs. The formulas show how to transform any right triangle with integer legs into another right triangle with integer legs whose hypotenuse is the square of the first triangle's hypotenuse.

A Pythagorean prime is a prime number of the form . 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 for which is the length of the hypotenuse of a right triangle with integer legs, and they are also the prime numbers for which itself is the hypotenuse of a primitive Pythagorean triangle. For instance, the number 5 is a Pythagorean prime; is the hypotenuse of a right triangle with legs 1 and 2, and 5 itself is the hypotenuse of a right triangle with legs 3 and 4.