All pythagorean triples can be generated from $(3,4,5)^T$ and $(5,4,3)^T$ by the matrices: \\[ A = \left(\begin{array}{ccc} -1 & 2 & 2 \\\\ -2 & 1 & 2 \\\\-2 & 2 & 3 \end{array} \right) \hspace{0.25in} B = \left(\begin{array}{ccc} 1 & 2 & 2 \\\\ 2 & 1 & 2 \\\\2 & 2 & 3 \end{array} \right) \hspace{0.25in} C = \left(\begin{array}{ccc} 1 & -2 & 2 \\\\ 2 & -1 & 2 \\\\2 & -2 & 3 \end{array} \right) \\] Giving pythagorean triples the structure of a ternary tree. These correspond to generators of $\mathrm{O}(\mathbb{Z}^3, x^2+y^2-z^2)$ and we're looking for integer points on the ``light cone" where the norm is zero. I remember seeing there being 5 generators for the quadratic $x^2 + xy + y^2 = z^2$. Does anyone have the reference?