Find all functions $f:\mathbb{N} \to \mathbb{N}$ so that for any distinct positive integers $x,y,z$ the value of $x+y+z$ is a perfect square if and only if $f(x)+f(y)+f(z)$ is a perfect square.
1. **Lemma 1: \( f \) is injective.**

   **Proof:**
   Suppose that \( f(a) = f(b) \) for some positive integers \( a \) and \( b \). Then, for any integers \( x \) and \( y \) such that \( a + x + y \) is a perfect square, we have that \( f(a) + f(x) + f(y) \) is a perfect square. Since \( f(a) = f(b) \), it follows that \( f(b) + f(x) + f(y) \) is also a perfect square. Therefore, \( b + x + y \) must be a perfect square as well.

   Let \( x + y = t^2 - a \) for some large positive integer \( t > 10^{10^{10^{10}}} \cdot \max(a, b) \). Then, \( a + x + y = t^2 \) is a perfect square, and so \( b + x + y = t^2 \) must also be a perfect square. This implies \( a = b \). Hence, \( f \) is injective. \(\blacksquare\)

2. **Lemma 2: \( f(a) + f(b) = f(c) + f(d) \) when \( a + b = c + d \), \( a < c < d < b \).**

   **Proof:**
   Since \( f \) is injective, the set \( S \) of positive integers \( \alpha \) satisfying \( f(\alpha) \le \max(f(a), f(b), f(c), f(d))^2 \cdot 10^{10^{10^{10}}} \) is finite. Select some \( t > a + b + c + d + \max_{e \in S} e \) such that \( t + a + b \) is a perfect square. Then, \( f(t) + f(a) + f(b) \) and \( f(t) + f(c) + f(d) \) are both perfect squares.

   Let \( n = f(a) + f(b) + f(c) + f(d) \). Since \( f(t) + f(a) + f(b) \) and \( f(t) + f(c) + f(d) \) are both perfect squares and differ by at most \( t \), they must be equal. Therefore, \( f(a) + f(b) = f(c) + f(d) \). \(\blacksquare\)

3. As a result of Lemma 2, we have that \( f(x+1) + f(1) = f(x) + f(2) \) for any \( x \ge 3 \). Let \( d = f(2) - f(1) \). Then, \( f(a+1) - f(a) = d \) for all \( a \in \mathbb{N} \setminus \{2\} \).

4. By another application of Lemma 2, we obtain \( f(3) - f(2) = f(11298347284) - f(11298347283) = d \). Thus, \( f(a+1) - f(a) = d \) for all \( a \in \mathbb{N} \). Therefore, \( f \) can be written in the form \( f(x) = dx + c \) for some integers \( d \) and \( c \), with \( d \) and \( d + c \) both positive.

5. Now, observe that if \( m = dx + c + dy + c + dz + c \) is a square for some distinct \( x, y, z \in \mathbb{N} \), then so is \( x + y + z \), and hence so is \( 4x + 4y + 4z \). Finally, so is \( 4dx + c + 4dy + c + 4dz + c = 4m - 3c \). Since \( 4m \) is also a square, we either have \( c = 0 \) or \( m \le 10^{10^{10^{10}}} \cdot c^2 \).

6. Since the above holds for \( m = d \cdot 1 + c + d \cdot 2 + c + d \cdot (t^2 - 3) + c \) for arbitrarily large positive integers \( t \), the second option is absurd. Therefore, \( c = 0 \). As a result, we know that our function is of the form \( f(x) = dx \) for some \( d \in \mathbb{N} \).

7. From here, it's clear that \( d \) must be a perfect square. Hence, \( f(x) \equiv k^2 x \) for \( k \in \mathbb{N} \) are indeed our only solutions.

\(\blacksquare\)

The final answer is \( \boxed{ f(x) = k^2 x } \) for \( k \in \mathbb{N} \).