Norm of Gaussian integers: solutions to $N(a) = k$ for $k \in \mathbb{N}$ and $a$ a Guassian integer I have two questions.


*

*Which integers are equal to the norm of some Gaussian integer? In general, how many solutions does$$\text{N}(a) = k$$have for a given $k \in \mathbb{Z}$?

*I am investigating the equation$$\text{N}(a) = 1$$where now we take $a \in \mathbb{Q}(i)$. What is a method for producing solutions to this equation using the arithmetic of $\mathbb{Z}[i]$. Can we produce them all? Is this related to any other topics in elementary number theory?

 A: *

*For $n \in \mathbb{N}$, $n$ is the norm of a Guassian integer iff $k = x^2 + y^2$ for some integers $x, y$. This is a classic question and  known to be true exactly when $n$ has an even number of copies of each prime $p \equiv 3 \pmod{4}$.
See this math fun fact.
Primes $p \equiv 3 \pmod{4}$ are particularly significant in the Gaussian integers $\mathbb{Z}[i]$ as they are exactly the primes $\in \mathbb{Z}$ that remain prime in $\mathbb{Z}[i]$.
In how many ways is a harder question; this is essentially Gauss's circle problem and you can read up on it there. However, if you just want to know in how many ways "on average", then as $n \to \infty$ it can be written as a sum of two squares in about $\pi$ ways. This is another math fun fact, with an elegant proof.

*The solutions to $N(a) = 1$ for $a = \mathbb{Q}(i)$ are given by
$$a = \pm \frac{x}{z} \pm \frac{y}{z}i$$
for primitive pythagorean triples $(x,y,z)$. This is also a classic problem and the solutions can be parametrized. For example, the solutions to $N(a) = 1$ are given exactly by $\pm 1$, $\pm i$, and
$$
a = u \cdot \left( \frac{m^2 - n^2}{m^2 + n^2} \pm \frac{2mn}{m^2 + n^2} i \right)
$$
where:


*

*$m,n$ range over all pairs of positive integers $m > n > 0$ such that $m,n$ are relatively prime and not both odd;

*$u \in \{1, -1, i, -i\}$ is a unit.
This parametrization has no duplicate counting.
You can tweak the parametrization in various ways to suit your preferences.
You just have to be careful (if you want no double-counting) to handle the units properly. Most triples like $(3,4,5)$ generate $8$ solutions: $\pm \frac{3}{5} \pm \frac{4}{5}i$ and $\pm \frac{4}{5} \pm \frac{3}{5}i$. But the trivial triple $(0, 1, 1)$ generates only four solutions, $\pm 1, \pm i$.
