How many elements are in the set:
$\{(x,y,z) \mid x+y+z = k \text{ and } x,y,z \in \{0,\dotsc,n\}\}$
I can see that when $k \le n$, it's $\binom{k+2}{2}$. And, by symmetry, the value for $k$ is the same as that for $3n-k$. So, I've figured out the two pyramids, and I'm just missing the octahedron in the middle.