Summary: The characterization of numbers representable as the sum of two squares in terms of their divisors has been known since the 17th century (Girard, Fermat) but not proved until 18th century (Euler). A refinement involving the number $R(n)$ of representations of $n$ as sum of two squares was proved by Jacobi using theta functions. This article starts out by reproducing a very elementary proof due to Heath-Brown of Fermatâ€™s characterization of primes of type $4n+1$. Then it turns to discussing problems concerning asymptotic distribution, occurrence in prescribed intervals, infinite occurrences of patterns such as $n,n+h_1$, $n+h_2\dots h_k$ for fixed $h_i$ (It is shown that $n,n+1$, $n+2$ occurs infinitely often, but of course $n,n+1,n+2,n+3$ may never all be sums of two squares.) Those are compared with the corresponding statements for primes. One may note that the asymptotic behaviour of $B(x)=\sum_{n= a^2+b^2C\log x$ for some suitable constant $C$, but so far it has only been shown for $h>Cx^{\frac 14}$. But if we relax the condition to almost all such intervals, there is a complete solution.