Characterize $n$ for which $\frac{x^n+y^n+(-x-y)^n}{2}$ is automatically a square integer

This is my first question here after a lot of lurking. I hope it's found to be at an appropriate level for the site.

This question found its way to me - it supposedly originates as an extra credit problem assigned to an advanced high school student, but I have some graduate level education in math and haven't been able to find an answer, so I'm skeptical.

Let $x,y,z\in \mathbb{Z}$ satisfy $x+y+z=0$. Consider the expression $\frac{x^n+y^n+z^n}{2}$. For what $n\in\mathbb{Z}$ is it true that our expression is automatically the square of some integer, regardless of the particular values of $x,y,z$?

It's easy to see that $n=1$ is one solution, since the expression is then identically zero.

One can also discover with some playing around that $n=4$ works, because it turns out that $\frac{x^4+y^4+(-x-y)^4}{2}=(\frac{x^2+y^2+(-x-y)^2}{2})^2$ - that is, the expression at $n=4$ is identically the square of the expression at $n=2$.

Empirical searches with computer software suggest that $n=1$ and $n=4$ are in fact the only solutions possible. Can anybody here prove this?

As a simple preliminary step, one can deduce that $n$ must be of the form $n=2^k$ for some integer $k$, or else the denominator $2$ in the expression will never cancel out and yield an integer. But at that point, I'm stuck.

• This problem is form the USAMTS 2016-17 Round 1 problem set, the deadline just expired a week ago, so its okay to talk about it now. The solution can be found here: usamts.org/Solutions/Solutions_28_1.pdf – wythagoras Oct 24 '16 at 20:02
• The question is from the USA Mathematics Talent Search. It is problem 3 of the first round from this year. One solution can be found here usamts.org/Solutions/Solutions_28_1.pdf – Dylan Oct 24 '16 at 20:02
• Wow, thank you both for those quick replies! Turns out the solution is of course exactly the kind of "clever" math competition trick that makes me want to pull my hair out. This question could be closed now. – Franciscus Rebro Oct 24 '16 at 20:17

Take $x=2$, $y=z=-1$. if $n=2m$ with $m\in\Bbb{N}$, we have: $$\dfrac{x^n+y^n+z^n}2=\dfrac{2^{2m}+2}{2}=2^{2m-1}+1$$ Suppose now that $$2^{2m-1}+1=k^2$$ $$2^{2m-1}=(k+1)(k-1)$$ So, $k+1$ and $k-1$ are powers of $2$, so $k=3\implies m=2\implies n=4$. $n=4$ was verified by you and now we know it's the only even option for $n$.
Now, take $n=2m+1$. We obtain: $$\dfrac{x^n+y^n+z^n}2=\dfrac{2^{2m+1}-2}{2}=k^2$$ $$(2^m)^2-1=k^2$$ The only two squares that differ by $1$ are $0^2$ and $1^2$, which gives $k=0\implies m=0\implies n=1$, which is the other validated option.