I've seen a few posts asking about the same form but for prime number $p$. I want to know how this can be extended to a general integer $n$. This property is certainly not exclusive to primes since $6= 2^2 + 2 \times 1^2$.
I’m not sure if prime decomposition would help because we would need to multiply with the remaining primes and that would mess up the form.
I can sense a slight relation to Fermat’s theorem on how $p=x^2 +y^2$ iff $p \equiv 1 \pmod 4$ but again this works for primes.
Any help would be much appreciated.