$2017$ as the sum of two squares Write the prime $2017$ as the sum of two squares
$2017$ can be written as the sum of two squares because it is a prime of the form $p\equiv 1\ ($mod $4)$
Using an appropriate algorithm find the two numbers that, when squared, add to the total of $2017$

About 200 years ago, Jacobi would have known, and shown, that the number of representing 2017 as a sum of two squares is exactly 8. 
More generally, for a positive integer $n$, let $r_2(n)$ denote the number of representations of $n$ as a sum of two squares of integers; for example, $r_2(5) = 8$, since $5 = 2^2 + 1^2 = (-2)^2 + 1^2 = 2^2 + (-1)^2 = (-2)^2 + (-1)^2 = 1^2 + 2^2 = 1^2 + (-2)^2 = (-1)^2 + 2^2 = (-1)^2 + (-2)^2.$
Let also $d_1(n)$ denote the number of positive divisors of $n$ of the form $4k+1$ and $d_3(n)$ the number of positive divisors of $n$ of the form $4k+3$. Jacobi's Formula is
$$
r_2(n) = 4(d_1(n) - d_3(n)) .
$$
Since 2017 is prime, and equal to $4 \times 504 + 1$, we have immediately $r_2(2017) = 4(2-0) = 8$. Easy to check:
$2017 = (44)^2 + 9^2 = (-44)^2 + 9^2 = \cdots$.
One out of many possible references for a proof of the formula of Jacobi: Theorem 3.2.1 in
Bruce C. Berndt, Number Theory in the Spirit of Ramanujan, Student Mathematical Library 34, Amer. Math Soc. 2006.
