For what polynomials $P(n)$ with integer coefficients can a positive integer be assigned to every lattice point in $\mathbb{R}^3$ so that for every integer $n \ge 1$, the sum of the $n^3$ integers assigned to any $n \times n \times n$ grid of lattice points is divisible by $P(n)$?

[i]Proposed by Andre Arslan[/i]
1. **Initial Setup and Claim:**
   We claim that the answer is \( P(x) = c \cdot x^k \). Let \( f(x,y,z) \) be the number assigned to the point \((x,y,z)\). Assume that a polynomial \( P(n) \) works. Define:
   \[
   a_k = \sum_{x \leq n} \sum_{y \leq n} f(x,y,k)
   \]
   Then, \(\ldots, a_{-1}, a_0, a_1, \ldots\) is the 1D version of the original problem. We will denote \( P \) by \( P_0 \) from now on. Notice that \( a \) divides \( b \) implies \( P_0(a) \) divides \( P_0(b) \).

2. **First Claim:**
   \( x \) divides \( P_0(x) \) or \( P_0 \) is constant.

   Let \( P_0(x) = x \cdot P_1(x) + C \). We would like to show \( C = 0 \). We have:
   \[
   n \cdot P_1(n) + C \text{ divides } nk \cdot P_1(nk) + C
   \]
   \[
   \implies n \cdot P_1(n) + C \text{ divides } nk \cdot P_1(nk) - n \cdot P_1(n) = n(P_1(nk) - P_1(n))
   \]

3. **Contradiction Argument:**
   Since \( C \neq 0 \), we can choose infinitely many \( n \) where \( \gcd(n, C) = 1 \). Thus, \( \gcd(n \cdot P_1(n) + C, n) = 1 \). So, \( n \cdot P_1(n) + C \) divides \( P_1(nk) - P_1(n) \). But:
   \[
   \deg(n \cdot P_1(n) + C) > \deg(P_1(nk) - P_1(n))
   \]
   This implies the LHS gets larger than the RHS for sufficiently large \( n \). Hence, the divisibility cannot hold. Therefore, \( C = 0 \), and we have \( P_0(x) = x \cdot P_1(x) \).

4. **Second Claim:**
   \( P_1 \) is divisible by \( x \) or \( P_1 \) is constant.

   Recall we have \( P_0(n) \) divides \( \sum_{i=1}^n a_{k+i} \) for every \( k \) and \( n \). This implies that \( n \) and \( P_1(n) \) divide \( \sum_{i=1}^n a_{k+i} \). So:
   \[
   a_k \equiv a_{k+n} \equiv a_{k+P_1(n)} \pmod{P_1(n)}
   \]
   By Bezout's identity, we have:
   \[
   a_k \equiv a_{k + \gcd(n, P_1(n))} \pmod{P_1(n)}
   \]

5. **GCD Argument:**
   Assume that \( \gcd(n, P_1(n)) = 1 \) infinitely often. This means that:
   \[
   a_k \equiv a_{k+1} \pmod{P_1(n)}
   \]
   for infinitely many choices of \( n \). This implies the sequence \( a_i \) is constant, so \( P_0 \) is constant. Thus, \( \gcd(n, P_1(n)) = 1 \) finitely often. Hence, if we choose sufficiently large primes \( p_1, p_2, \ldots \), then \( p_i \) divides \( P_1(p_i) \) for all \( i \). So:
   \[
   P_1(p_i) \equiv P_1(0) \equiv 0 \pmod{p_i}
   \]
   for infinitely many primes. Thus, \( P_1(0) = 0 \), giving \( x \) divides \( P_1(x) \) as desired.

6. **Inductive Step:**
   We proceed with the same proof inductively for \( P_2, P_3, \ldots \). Each one is either divisible by the identity or constant. Thus, \( P(x) = c \cdot x^k \) as desired.

7. **Construction:**
   For construction, we can use a "just do it approach" on \( a_0, a_1, a_{-1}, a_2, a_{-2}, \ldots \), choosing each one appropriately. We can do this by the Chinese Remainder Theorem (CRT).

   Therefore, the solution is complete. \(\blacksquare\)

The final answer is \( \boxed{ P(x) = c \cdot x^k } \)