6. Given that all positive integers are in $n$ sets, satisfying that when $|i-j|$ is a prime number, $i$ and $j$ belong to two different sets. Then the minimum value of $n$ is $\qquad$
6. 4 .

It is easy to see that $n \geqslant 4$ (2, 4, 7, 9 must be in four different sets).
Also, when $n=4$, the sets
$$
A_{i}=\left\{m \in \mathbf{Z}_{+} \mid m \equiv i(\bmod 4)\right\}(i=0,1,2,3)
$$

satisfy the condition.
Therefore, the minimum value of $n$ is 4.