8. If integers $a, b$ are neither coprime nor have a divisibility relationship, then $a, b$ is called a "coalition" pair; let $A$ be an $n$-element subset of the set $M=\{1,2, \ldots, 2017\}$, and any two numbers in $A$ are "coalition" pairs, then the maximum value of $n$ is $\qquad$.
8. 504

Analysis: Call such a subset $A$ a "coalition subset"; first, we can construct a coalition subset with 504 elements. Take $A=\{2 k \mid k=505,506, \mathrm{~L}, 1008\}$ which satisfies the requirements. The following proves that 504 is the maximum value of $n$. Suppose $A$ is a coalition subset with the maximum number of elements, $A=\left\{a_{1}, a_{2}, \mathrm{~L}, a_{n}\right\}$. If $a_{j}$ is the smallest number in set $A$, it is clear that $a_{j}>1$. If $a_{j} \leq 1008$, then $2 a_{j} \leq 2016$, i.e., $2 a_{j} \in M$, and clearly $2 a_{j} \notin A$ (since $2 a_{j}$ and $a_{j}$ have a divisibility relationship). Now, replace $a_{j}$ in $A$ with $2 a_{j}$, keeping the other elements unchanged, to form the subset $A^{\prime}$. Then $A^{\prime}$ is still a coalition subset, because for any element $a_{i}$ in $A$ different from $a_{j}$, since $a_{j}$ and $a_{i}$ are not coprime, $2 a_{j}$ and $a_{i}$ are also not coprime; further, $2 a_{j}$ and $a_{i}$ do not have a divisibility relationship: since $a_{j} \square a_{i}$, then $2 a_{j} \square a_{i}$; and if $a_{i} \mid 2 a_{j}$, let $2 a_{j}=k a_{i}$ (clearly $k \neq 1,2$, otherwise $a_{i}, a_{j}$ have a divisibility relationship), then $k>2$, thus $a_{i}<a_{j}$, which contradicts the minimality of $a_{j}$! Therefore, $A^{\prime}$ is still a coalition subset, and it remains an $n$-element set; repeat the above process until all elements in the subset are greater than 1008, thus obtaining an $n$-element coalition subset $B=\left\{b_{1}, b_{2}, \mathrm{~L}, b_{n}\right\}$, where $1008<b_{j} \leq 2017$. That is, $B \subseteq\{1009,1010, \mathrm{~L}, 2017\}$. Since any two consecutive integers are coprime, at most 505 non-adjacent numbers can be selected from these 1008 consecutive positive integers, i.e., $n \leq 505$. But if $n=505$, the selected numbers are all odd, which does not satisfy the condition, hence according to the construction mentioned earlier, the maximum value of $n$ is 504.