\[\sum(-1)^{k}p\left(\mathcal{D},n-\tfrac{1}{2}(3k^{2}\pm k)\right)=\begin{cases%
}(-1)^{r},&n=3r^{2}\pm r,\\
0,&\mbox{otherwise},\end{cases}\]