Find all positive integers $n$ for which $(x^n+y^n+z^n)/2$ is a perfect square whenever $x$, $y$, and $z$ are integers such that $x+y+z=0$. 
1. **Case 1: \( n \) is odd**

   We start by considering the case where \( n \) is an odd integer. Suppose there exists an odd integer \( n \) such that for all integers \( x, y, z \) with \( x + y + z = 0 \), the expression \(\frac{x^n + y^n + z^n}{2}\) is a perfect square. 

   Let's choose \( x = 2 \), \( y = -1 \), and \( z = -1 \). Then we have:
   \[
   x + y + z = 2 + (-1) + (-1) = 0
   \]
   Substituting these values into the expression, we get:
   \[
   \frac{2^n + (-1)^n + (-1)^n}{2} = k^2
   \]
   Simplifying, we obtain:
   \[
   \frac{2^n + 2(-1)^n}{2} = k^2
   \]
   \[
   2^{n-1} + (-1)^n = k^2
   \]
   Since \( n \) is odd, we can write \( n = 2i + 1 \) for some nonnegative integer \( i \). Thus, we have:
   \[
   2^{(2i+1)-1} + (-1)^{2i+1} = 2^{2i} - 1 = (2^i)^2 - 1 = k^2
   \]
   However, for \( i > 0 \), there is no solution because perfect squares other than 0 and 1 differ by more than 1. Therefore, the only possible solution for \( i = 0 \) is \( n = 1 \). Hence, for odd \( n \), \( n = 1 \) is the only solution.

2. **Case 2: \( n \) is even**

   Now, consider the case where \( n = 2i \) is even. We need to show that for integers \( x, y, z \) with \( x + y + z = 0 \), the expression \(\frac{x^4 + y^4 + z^4}{2}\) is always a perfect square.

   Given \( x + y + z = 0 \), we can write \( z = -x - y \). Substituting this into the expression, we get:
   \[
   \frac{x^4 + y^4 + (-x-y)^4}{2}
   \]
   Expanding \((-x-y)^4\), we have:
   \[
   (-x-y)^4 = (x+y)^4 = x^4 + 4x^3y + 6x^2y^2 + 4xy^3 + y^4
   \]
   Therefore:
   \[
   \frac{x^4 + y^4 + (x+y)^4}{2} = \frac{x^4 + y^4 + x^4 + 4x^3y + 6x^2y^2 + 4xy^3 + y^4}{2}
   \]
   Simplifying, we get:
   \[
   \frac{2x^4 + 4x^3y + 6x^2y^2 + 4xy^3 + 2y^4}{2} = x^4 + 2x^3y + 3x^2y^2 + 2xy^3 + y^4
   \]
   Notice that:
   \[
   x^4 + 2x^3y + 3x^2y^2 + 2xy^3 + y^4 = (x^2 + xy + y^2)^2
   \]
   which is a perfect square since \( x^2 + xy + y^2 \) is an integer. Therefore, \( n = 4 \) is a solution.

3. **Uniqueness of \( n = 4 \) for even \( n \)**

   We now prove that \( n = 4 \) is the only solution for even \( n \). Consider \( (x, y, z) = (2, 2, -4) \). We need to show that:
   \[
   \frac{2^{2i} + 2^{2i} + 4^{2i}}{2} = \frac{4^i + 4^i + 16^i}{2} = k^2
   \]
   has a unique integer solution \( i = 2 \). Rewriting, we get:
   \[
   2k^2 = 2(4^i) + 4^i(4^i) = 4^i(2 + 4^i)
   \]
   \[
   k^2 = 4^i \left(1 + \frac{4^i}{2}\right)
   \]
   Since \( 4^i \) is a perfect square, we must have:
   \[
   1 + \frac{4^i}{2}
   \]
   be a perfect square \( c^2 \). Thus:
   \[
   c^2 = 1 + \frac{4^i}{2}
   \]
   \[
   c^2 - 1 = (c+1)(c-1) = \frac{4^i}{2} = \frac{2^{2i}}{2} = 2^{2i-1}
   \]
   Notice that \( c+1 \) and \( c-1 \) are positive integers differing by 2, and their product is a perfect power of 2. The only powers of 2 that differ by 2 are \( 2^1 \) and \( 2^2 \). Therefore, there is a unique solution \( c = 3 \), and from there, we get the unique solution \( i = 2 \), and \( n = 4 \).

We conclude that if \( n \) is odd, \( n = 1 \) is the only solution, and if \( n \) is even, \( n = 4 \) is the only solution. Therefore, the only solutions are \( \boxed{n = 1, 4} \).