Let $\mathbb N$ be the set of all positive integers. A subset $A$ of $\mathbb N$ is [i]sum-free[/i] if, whenever $x$ and $y$ are (not necessarily distinct) members of $A$,  their sum $x+y$ does not belong to $A$. Determine all surjective functions $f:\mathbb N\to\mathbb N$ such that, for each sum-free subset $A$ of $\mathbb N$, the image $\{f(a):a\in A\}$ is also sum-free.

[i]Note: a function $f:\mathbb N\to\mathbb N$ is surjective if, for every positive integer $n$, there exists a positive integer $m$ such that $f(m)=n$.[/i]
1. **Initial Observation**: We need to determine all surjective functions \( f: \mathbb{N} \to \mathbb{N} \) such that for any sum-free subset \( A \subseteq \mathbb{N} \), the image \( \{f(a) \mid a \in A\} \) is also sum-free. 

2. **Identity Function**: The function \( f(x) = x \) is a candidate. If \( A \) is sum-free, then \( \{f(a) \mid a \in A\} = A \) is also sum-free. We need to show that this is the only function that satisfies the condition.

3. **Claim 1**: For all \( x \in \mathbb{N} \), \( f(2x) = 2f(x) \). If \( f(y) = 2f(x) \), then \( y = 2x \).

    **Proof**: Suppose \( f(x) = c \). Since \( f \) is surjective, there exists \( y \) such that \( f(y) = 2f(x) = 2c \). Thus, \( f(x) + f(x) = f(y) \). If \( \{x, y\} \) is sum-free, then \( \{f(a) \mid a \in \{x, y\}\} \) must be sum-free, but \( f(x) + f(x) = f(y) \) contradicts this. Therefore, \( y = 2x \) or \( 2x = y \). Assume \( y = \frac{x}{2} \). Then \( f\left(\frac{x}{2}\right) = 2c \). By surjectivity, there exists \( y_1 \) such that \( f(y_1) = 4c = 2f\left(\frac{x}{2}\right) \). By the same logic, \( y_1 \in \left\{2 \cdot \frac{x}{2}, \frac{\frac{x}{2}}{2}\right\} = \left\{x, \frac{x}{4}\right\} \). Since \( y_1 \neq x \), \( y_1 = \frac{x}{4} \). Continuing this process, we get a sequence \( y_k \) such that \( f(y_k) = 2^{k+1}c \) and \( y_k = \frac{x}{2^k} \). This is impossible since \( \nu_2(x) \) is finite. Thus, \( y = 2x \) and \( f(2x) = 2f(x) \).

4. **Claim 2**: Let \( \{c_i\}_{i \geq 1} \) be a sequence of naturals such that \( f(c_i) = i \) for all \( i \geq 1 \). Then \( c_i = ic_1 \) for all \( i \geq 1 \).

    **Proof**: The \( c_i \) are pairwise distinct since if \( c_i = c_j \), then \( i = f(c_i) = f(c_j) = j \). We use induction on \( i \). For \( i = 1 \), the result is trivially true. For \( i = 2 \), by Claim 1, \( f(c_2) = 2 = 2f(c_1) \), so \( c_2 = 2c_1 \). For \( i = 3 \), \( f(c_3) + f(c_1) = f(c_4) \), and from Claim 1, \( f(c_4) = 2f(c_2) \), so \( c_4 = 2c_2 = 4c_1 \). Thus, \( \{c_1, c_3, c_4\} = \{c_1, c_3, 4c_1\} \) is not sum-free. Since \( \{c_1, 4c_1\} \) is sum-free, \( c_3 \in \{\frac{c_1}{2}, 2c_1, \frac{4c_1}{2}, 2(4c_1), 4c_1 - c_1, 4c_1 + c_1\} = \{\frac{1}{2}c_1, 2c_1, 3c_1, 5c_1, 8c_1\} \). If \( c_3 = \frac{1}{2}c_1 \), then \( f(c_1) = f(2c_3) = 2f(c_3) = 6 \), absurd. If \( c_3 = 2c_1 \), then \( f(c_3) = f(2c_1) = 2f(c_1) = 2 \), absurd. If \( c_3 = 8c_1 \), then \( f(c_3) = f(8c_1) = 2f(4c_1) = 4f(2c_1) = 8f(c_1) = 8 \), absurd. Thus, \( c_3 \in \{3c_1, 5c_1\} \). If \( c_3 = 5c_1 \), then \( f(c_5) = f(c_1) + f(c_4) = f(c_1) + f(4c_1) \), so \( \{c_1, 4c_1, c_5\} \) is not sum-free. Thus, \( c_5 \in \{\frac{c_1}{2}, 2c_1, \frac{4c_1}{2}, 2(4c_1), 4c_1 - c_1, 4c_1 + c_1\} = \{\frac{1}{2}c_1, 2c_1, 3c_1, 5c_1, 8c_1\} \). If \( c_5 = \frac{1}{2}c_1 \), then \( f(c_1) = f(2c_5) = 2f(c_5) = 10 \), absurd. If \( c_5 = 2c_1 \), then \( f(c_5) = f(2c_1) = 2f(c_1) = 2 \), absurd. If \( c_5 = 8c_1 \), then \( f(c_5) = f(8c_1) = 8f(c_1) = 8 \), absurd. Thus, \( c_5 \in \{3c_1, 5c_1\} \). \( c_5 \) cannot be \( 5c_1 \) since we are assuming for the sake of contradiction that \( c_3 = 5c_1 \), and we know \( c_3 \neq c_5 \). Thus, \( c_5 = 3c_1 \). Now, since \( c_3 = 5c_1 \), it follows that \( c_6 = 2c_3 = 10c_1 \) by Claim 1, so \( f(c_1) + f(c_5) = f(c_1) + f(3c_1) = f(10c_1) = f(c_6) \), but \( \{c_1, 3c_1, 10c_1\} \) is sum-free, a contradiction. Thus, \( c_3 = 3c_1 \).

    Now, assume that for some \( k \geq 3 \), we have that for all \( 1 \leq i \leq k \) that \( c_i = ic_1 \). Then, \( f(c_{k+1}) = f(c_1) + f(c_k) = f(c_1) + f(kc_1) \), so \( \{c_1, kc_1, c_{k+1}\} \) is not sum-free. Since \( k \geq 3 \), \( \{c_1, kc_1\} \) is sum-free, so \( c_{k+1} \in \{\frac{c_1}{2}, 2c_1, \frac{kc_1}{2}, 2kc_1, kc_1 - c_1, kc_1 + c_1\} = \left\{\frac{1}{2}c_1, 2c_1, \frac{k}{2}c_1, (k-1)c_1, (k+1)c_1, 2kc_1\right\} \). If \( c_{k+1} = \frac{1}{2}c_1 \), then \( f(c_1) = f(2c_{k+1}) = 2f(c_{k+1}) = 2k+2 \), absurd. If \( c_{k+1} = 2c_1 \), then \( f(c_{k+1}) = f(2c_1) = 2f(c_1) = 2 \), absurd. If \( c_{k+1} = \frac{k}{2}c_1 \), then \( k = f(c_k) = f(kc_1) = f(2c_{k+1}) = 2f(c_{k+1}) = 2k+2 \), absurd. If \( c_{k+1} = 2kc_1 \), then \( f(c_{k+1}) = f(2kc_1) = 2f(kc_1) = 2f(c_k) = 2k \), absurd. If \( c_{k+1} = (k-1)c_1 \), \( c_{k+1} = (k-1)c_1 = c_{k-1} \), absurd. Thus, \( c_{k+1} = (k+1)c_1 \), as desired, so our inductive step is complete and so we are done.

5. **Conclusion**: Since \( f \) is surjective, there exists such a sequence \( \{c_i\} \), so fix such a sequence. If there existed a \( d_1 \neq c_1 \) for which \( f(d_1) = 1 \), then \( d_1, c_2, c_3, \cdots \) is also a valid sequence, so \( c_2 = 2d_1 \). But \( c_2 = 2c_1 \), so \( c_1 = d_1 \), a contradiction. So \( f \) is injective at \( 1 \). Now, \( f \) is injective at any \( j > 1 \) since if there existed a \( d_j \neq c_j \) for which \( f(d_j) = j \), then \( c_1, c_2, \cdots, c_{j-1}, d_j, c_{j+1}, \cdots \) is also a valid sequence, so \( d_j = jc_1 \). But \( c_j = jc_1 \) as well, so \( c_j = d_j \), a contradiction. Thus, \( f \) is bijective, so there exists an \( i \) for which \( c_i = 1 \). Then, \( 1 = ic_1 \), so \( i \mid 1 \), implying \( i = 1 \). Thus, \( c_1 = 1 \), so \( c_i = i \), and so \( f(i) = i \) for all \( i \geq 1 \), as desired.

\(\blacksquare\)

The final answer is \( \boxed{ f(x) = x } \)