TITLE: How many solutions are there to $\sum_{i=1}^3 x_i^2+x_iy_i+y_i^2=k$?
QUESTION [7 upvotes]: Let $k$ be a positive integer. Let
$$Q=
\begin{pmatrix}
 1 &1/2&   &   &   &   \\
1/2& 1 &   &   &   &   \\
   &   & 1 &1/2&   &   \\
   &   &1/2& 1 &   &   \\
   &   &   &   & 1 &1/2\\
   &   &   &   &1/2& 1 
\end{pmatrix}.
$$

How many solution $x\in\mathbb Z^6$ are there to $\quad  x^tQx=k$?

This is equivalent to: 

How many solution $x\in\mathbb Z^6$ are there to 
  $$x_1^2+x_1x_2+x_2^2+ x_3^2+x_3x_4+x_4^2+ x_5^2+x_5x_6+x_6^2=k?$$

or to

How many solution $x\in \mathbb Z\left[\omega \right]^3$ are there to $\quad x^* I_3 x=k$?

where $I_3$ is the $3\times3$-identity matrix and $\omega=\frac{1+\sqrt{-3}}{2}$.
I know that there is a formula for this number (there is only one class in its genus), but I don't know it.
This question is related to

which integers take the form x^2 + xy + y^2 ?
https://math.stackexchange.com/questions/44139/how-many-solutions-are-there-to-fn-m-n2nmm2-q/

but they don't answer my question.

REPLY [7 votes]: This is a supplement to Noam Elkies' nice answer. The coefficients $s(k)$ can be expressed as
$$ s(k)=27\sum_{d\mid k}\chi(k/d)d^2-9\sum_{d\mid k}\chi(d)d^2, $$
hence the function $\varphi$ is a linear combination of
$$E_1:=\sum_{k=1}^\infty\sum_{d\mid k}\chi(k/d)d^2q^k
\quad\text{and}\quad
E_2:=1-9\sum_{k=1}^\infty\sum_{d\mid k}\chi(d)d^2q^k.$$
The latter functions are proportional to the standard Eisenstein series
$$ E_1':=\sum'_{m,n\in\mathbb{Z}}\chi(m)(mz+n)^{-3}
\quad\text{and}\quad
E_2':=\sum'_{m,n\in\mathbb{Z}}\chi(n)(mz+n)^{-3},$$
which form a basis of the space of modular forms $M_3(\Gamma_0(3),\chi)$, hence indeed $\varphi$ lies in this space. For more details see Section 7.1 in Miyake: Modular Forms, especially Lemma 7.1.1 and Theorem 7.1.3.