Representing primes in binary quadratic forms

Introduction Prime numbers are of great importance in mathematics. An integer \(p\) is called prime if the only divisors are \(1\) and \(p\). There was always a curiosity about the patterns which can be found in prime numbers. There are sequences of numbers like even numbers, triangular numbers whose \(n^{\text{th}} \) can be easily predicted. For example \(n^{\text{th}} \) triangular number is given by the formula $$ \frac{n(n+1)}{2}$$ There are also other sequences like Fibonacci numbers whose \(n^{\text{th}} \) is given by the formula $$ F_n = F_{n-1} + F_{n-2}$$ with \( F_1=F_0=1\). It turns out that no nice formula for \(n^{\text{th}} \) prime number is known. So people started looking out for other patterns. In 1640, Fermat wrote a letter to Mersenne in which he mentions " Every prime number which surpasses by one a multiple of four is composed of two squares. Examples are 5, 13, 17, 29, 37, 41, etc. " Formally for any prime \( p \) $$ p =...