Prove that $\forall k = m^2 + 1. \space m \in \mathbb{Z}^+$, if $k$ is divisible by any prime then that prime is congruent to $1, 2 \pmod 4$. 
Prove that $\forall k = m^2 + 1. \space m \in \mathbb{Z}^+$, if $k$ is divisible by any prime then that prime is congruent to $1, 2 \pmod 4$.

I am unable to realize why it can't have $2$ prime factors congruent to $3 \pmod 4$. Can anyone please help me proceed?
Thanks.
 A: Hiding the major revelations in spoiler quotes.

Suppose that $p\mid m^2+1$
Suppose for contradictory purposes that $p=4z+3$ for some $z\in\Bbb Z$.
Note that $p\not\mid m$ and $2\neq p$

 This is because $4z+3$ is always odd.  Further $k=m^2+1$ so $k\equiv 1\pmod{m}$ implying that $p\nmid m$ for any $p\mid k$.

Then $m^{p-1}\equiv 1\pmod{p}$ by fermat's little theorem.

 Further, we know that $m^2+1\equiv 0\pmod{p}$ so $m^2\equiv -1\pmod{p}$

.

 But then, that implies $m^{p-1}=m^{4z+2}=(m^2)^{2z+1}\equiv (-1)^{2z+1}\equiv -1\pmod{p}$

A contradiction.
A: If $p$ is an odd prime that divides $m^2+1$, then $m^2 \equiv -1 \bmod p$ and $m^4 \equiv 1 \bmod p$. Therefore, $m$ has order $4$ mod $p$. By Lagrange's theorem, we must have that $4$ divides $p-1$. In other words, $p \equiv 1 \bmod 4$.
A: Another solution: Suppose that $ p $ divides $ m^2 + 1 = (m-i)(m+i) $. Since primes that are 3 mod 4 are inert in $ \mathbb{Z}[i] $, and since $ p $ divides neither of the factors on the right, but divides $ m^2 + 1 $, it cannot be prime in $ \mathbb{Z}[i] $, which means it is 1 or 2 modulo 4. (This is because $ \mathbb{Z}[i] $ is a principal ideal domain.)
A: Another approach that looks similar to the one by @Starfall:
First it is easy to show that $p\not\equiv0\pmod4,$ as every number divisible by $4$ is not a prime.
Then, as stated in this question, that $p$ divides $m^2+1$ for some $m\in\mathbb Z$ implies that the ideal $(p)$ becomes a product of two prime ideals $\mathfrak p_1,\mathfrak p_2.$ Now we have $$(p^2)=N(p)=N(\mathfrak p_1)\cdot N(\mathfrak p_2)$$ and neither of $N(\mathfrak p_1)$ and $N(\mathfrak p_2)$ can be $(1),$ as they do not contain units. Thus $N(\mathfrak p_1)=(p).$
This shows that $p=x^2+y^2$ for some $x,y\in\mathbb Z.$ This means that $p\equiv1,2\pmod4,$ as $x^2\equiv0,1\pmod4$ for every integer $x,$ and $p\not\equiv0\pmod4.$  
Hope this helps.
