I am working on the problem: I need to quickly check if positive number $n$ can be expressed as $n^2=a^2+b^2$. I found this theorem: <https://en.wikipedia.org/wiki/Sum_of_two_squares_theorem>

But it seems I am missing something. For example number $4$ falls under theorem condition: its prime decomposition doesn't have any prime $p\equiv 3{\pmod {4}}$. But $4$ cannot be expressed as sum of 2 squares.