I would like to know if there is any existing research on the following problem:
$$\text{For }a, b \in \mathbb Z \text{, given }n = a^2 + b^2, \text{output }a, b$$.
Searching for "sum of squares", "quadratic sum", "two squares", etc. on eprint did not return any related results that I could find. The problem may have been given a particular name, but if it has, I don't know it, so I can't search for it.
I searched some of the math stackexchange sites and:
- There appears to be a relation between a decisional variant of the problem and factoring. Namely, "determine whether or not $n$ is a sum of two squares" can be solved with knowledge of the factorization of $n$.
- I found a result that allows the problem to be solved efficiently when $n$ is a prime congruent to $1 \bmod 4$.
The naive algorithm for solving the problem runs in time $O(\operatorname{sqrt}(n))$ by simply guessing all possible values for $a$ up to $\operatorname{sqrt}(n)$, squaring them, subtracting $a^2$ from $n$, then checking whether the result is a perfect square.
I would like to know any of the following:
- Is there pre-existing research on the problem that I can consult
- Does the problem have a name other than "Sum of two squares"
- Can we prove that the problem is either "hard" or "easy" for the usual definitions of the terms on a hard instance of the problem (e.g. one where $n$ is not a prime congruent to $1 \bmod 4$)