mathlib documentation

number_theory.sum_two_squares

Sums of two squares

Proof of Fermat's theorem on the sum of two squares. Every prime congruent to 1 mod 4 is the sum of two squares

theorem nat.prime.sum_two_squares (p : ) [hp : fact (nat.prime p)] :
p % 4 = 1(∃ (a b : ), a ^ 2 + b ^ 2 = p)

Fermat's theorem on the sum of two squares. Every prime congruent to 1 mod 4 is the sum of two squares