How to prove that $n=x^2+y^2$ if it is a product of primes congruent 3 mod 4 and 1,2 mod 4 I am stuck trying to show that if 
\begin{equation}
n=\prod p_i^{2e_i}\prod q_j^{f_j}
\end{equation}
where each $p_i\equiv3(mod~4)$ and each $q_j\equiv 1,2(mod 4)$ then each $p_i^{2e_i}$ and each $q_j^{f_j}$ is the norm of an element in $\mathbb{Z}[i]$ and thus $x^2+y^2=n$ for some $x,y\in \mathbb{Z}$
I really don't know where to start, so any hint would be so helpful.
 A: This is a simple model to show the solution.
Consider following product of primes in forms $(4k+1) and (4k+3)$:
$$n=(4 k_1+1)(4 k_2+3)(4 k_3+1)(4 k_4+3). . .$$
$$(4 k_1+1)(4 k_2+3)≡ 3 mod 4$$
$$(4 k_3+1)(4 k_4+3)≡ 3 mod 4$$
$$⇒ (4 k_1+1)(4 k_2+3)(4 k_3+1)(4 k_4+3)≡ 1 mod 4$$
Or $$(4 k_1+1)(4 k_2+3)(4 k_3+1)(4 k_4+3) = 4 k +1$$
It can be seen that in a t term product if number of terms in form of $(4 k +1)$is $(t/2 +1)$ then $n≡1 mod 4$, that is n, due to generalized Fermat theorem, (the sum of two squares theorem)can be written as the sum of two squares in particular cases.
It can be shown that there are infinitely many numbers of form $(4 p +1)$ which can be prime or composite and are the sum of two squares; thus one of squares say x must be even and the other must be odd, suppose:
$x= 2 a ⇒ x^2 = 4 a^2 $
$y= 2 b +1 ⇒  y^2 = 4 b^2 + 4 b + 1$
⇒ $x^2 + y^2=4( a^2 + b^2 + b) +1$
Since a and b can be any natural number then there are infinitely many numbers of form( 4 p +1) which are the sum of two squares. These numbers can be prime like $5417 = 4 . 1354 +1 = 44^2 + 59^2 $( resulted from a=22 and b = 29) or product of two or more numbers, like:
$2009 = 4 . 502 +1= 7 . 7 . 41 = 28^2 + 35^2$ (resulted from a=14 and b=17) 
or primes like:
$ 485 = 4 . 121 +1 = 5 . 97 = 14^2 + 17^2$ (resulted from a=7 and b=8)
There is no reason for the lack of infinitely many numbers like 485 which are the product of two or more primes and are the sum of two squares.
