How to classify solutions to the following equations? I would like to classify the sets of integers $a_{1},...,a_{n}$ that satisfy the following two equations.
$$\sum_{k=1}^{n}a_{k}\equiv 0\mod 2$$
$$\sum_{i\neq j}a_{i}a_{j}=0$$
For example, if $n=3$, I believe all irreducible solutions (those that are not of the form $\{2a,2b,2c\}$ for another solution $\{a,b,c\}$) are of the form $\{x-y,x+y,\frac{1}{2}(z-x)\}$ for any choice of $x,y,z$ such that $x\equiv z\mod 4$ and $y^2=xz$.
Another class of solutions are the sets $\{1,1,...,1,\frac{1}{2}(1-k)\}$ where there are $k$ 1's and $k\equiv 3\mod 4$.
Are there general methods that can be applied? Are there any other nice classes of solutions?
 A: Given $a_1, \ldots, a_{n-1}$, let $s = \sum_{i=1}^{n-1} a_i$ and $t = \sum_{i=1}^{n-1} a_i^2$.
Of course $s \equiv t \mod 2$.
Then $a_1, \ldots, a_{n-1}, x$ is a solution iff $x \equiv s \mod 2$ and
$s^2 + 2 s x = t$.  We may assume $s \ge 0$, as the solution set is invariant under multiplication by $-1$.  
If $s = 0$, then we need $t=0$ and thus $a_i = 0$ for all $i \le n-1$, and then any even $x$ will work.
Otherwise, we need $$x = \frac{t - s^2}{2s}$$
Note that $x + s = \frac{t+s^2}{2s}$, which must be an integer divisible by $2$, i.e. $t+s^2$ is divisible by $4s$.  Thus $t = 4 s m - s^2$ for some integer $m$.
Given $t > 0$, we need $t \equiv 0$ or $3$ mod $4$.  If $s$ is a divisor of $t$ with $t/s \equiv -s \mod 4$, we can then look for $a_1, \ldots, a_{n-1}$ with $\sum_i a_i = s$ and $\sum_i a_i^2 = t$.  The number of these is the coefficient of $x^s y^t$ in 
$$\left(\sum_{i=-\lfloor \sqrt{t}\rfloor}^{\lfloor \sqrt{t}\rfloor} x^i y^{i^2}\right)^{n-1}$$
Note that $s \le \sqrt{(n-1)t}$ by Cauchy-Schwartz.
