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?



How to classify solutions to the following equations?
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.


