4. Let $n$ be a positive integer, and two players $A$ and $B$ play a game where they take turns choosing a positive integer $k (k \leqslant n)$. The rules of the game are as follows:
(1) Each player cannot choose any number that has already been chosen by either player in any previous round.
(2) Each player cannot choose any number that is adjacent to any number they have already chosen in any previous round.
(3) If all numbers are chosen, the game is a draw; otherwise, the player who cannot choose a number loses the game.

If player $A$ starts the game and both players play optimally, determine the outcome of the game.
3. 3024.

Let $A=\left\{a_{1}, a_{2}, \cdots, a_{n}\right\}\left(a_{1}<a_{2}<\cdots<a_{n}\right)$.
For any non-empty finite set of positive integers $B$, denote $\mathrm{lcm} B$ and $\operatorname{gcd} B$ as the least common multiple and greatest common divisor of the elements in $B$, respectively.

Consider any good partition $\left(A_{1}, A_{2}\right)$ of $A$. By definition, there exists a positive integer $d$ such that
$\operatorname{lcm} A_{1}=d=\operatorname{gcd} A_{2}$.
For any $a_{i} \in A_{1}$ and $a_{j} \in A_{2}$, we have
$a_{i} \leqslant d \leqslant a_{j}$.
Thus, there exists a positive integer $k(1 \leqslant k<n)$ such that
$$
\begin{array}{l}
A_{1}=\left\{a_{1}, a_{2}, \cdots, a_{k}\right\}, \\
A_{2}=\left\{a_{k+1}, a_{k+2}, \cdots, a_{n}\right\} .
\end{array}
$$

Therefore, each good partition is determined by an element $a_{k}$ $(1 \leqslant k<n)$, which we call a "separator".
Define $l_{k}=\operatorname{lcm}\left(a_{1}, a_{2}, \cdots, a_{k}\right)$,
$g_{k}=\operatorname{gcd}\left(a_{k+1}, a_{k+2}, \cdots, a_{n}\right)$,

where $1 \leqslant k \leqslant n-1$. Then $a_{k}$ is a separator if and only if $l_{k}=g_{k}$.

To prove some properties of separators, we need the following lemma.

Lemma If $a_{k-1}$ and $a_{k}$ $(2 \leqslant k \leqslant n-1)$ are both separators, then $g_{k-1}=g_{k}=a_{k}$.
Proof Assume $a_{k-1}$ and $a_{k}$ are both separators.
By $l_{k-1}=g_{k-1} \Rightarrow l_{k-1} \mid a_{k}$
$\Rightarrow g_{k}=l_{k}=\operatorname{lcm}\left(l_{k-1}, a_{k}\right)=a_{k}$,
$g_{k-1}=\operatorname{gcd}\left(a_{k}, g_{k}\right)=a_{k}$.
The lemma is proved.
Property 1 For each $k=2,3, \cdots, n-2$, at least one of $a_{k-1}$, $a_{k}$, and $a_{k+1}$ is not a separator.
Proof of Property 1 Use proof by contradiction.
Assume $a_{k-1}$, $a_{k}$, and $a_{k+1}$ are all separators.
By the lemma, we have $a_{k+1}=g_{k}=a_{k}$, which is a contradiction.
Property 2 $a_{1}$ and $a_{2}$ cannot both be separators, and $a_{n-2}$ and $a_{n-1}$ cannot both be separators.
Proof of Property 2 Assume $a_{1}$ and $a_{2}$ are both separators.
By the lemma, we have $a_{2}=g_{1}=l_{1}=\operatorname{lcm}\left(a_{1}\right)=a_{1}$, which is a contradiction.

Similarly, assume $a_{n-2}$ and $a_{n-1}$ are both separators. By the lemma, we have $a_{n-1}=g_{n-1}=\operatorname{gcd}\left(a_{n}\right)=a_{n}$, which is a contradiction.
Properties 1 and 2 are proved.
Suppose a set $A$ with $n$ elements has exactly 2015 good partitions. Clearly, $n \geqslant 5$.

By Property 2, at most one element in $\left\{a_{1}, a_{2}\right\}$ and $\left\{a_{n-2}, a_{n-1}\right\}$ can be a separator.

Let $\lfloor x\rfloor$ denote the greatest integer not exceeding the real number $x$, and $\lceil x\rceil$ denote the smallest integer not less than the real number $x$.

By Property 1, at least $\left\lfloor\frac{n-5}{3}\right\rfloor$ elements in $\left\{a_{3}, a_{4}, \cdots, a_{n-3}\right\}$ are not separators. Therefore, $A$ has at most
$$
(n-1)-2-\left\lfloor\frac{n-5}{3}\right\rfloor=\left\lceil\frac{2(n-2)}{3}\right\rceil
$$

separators.
Thus, $\left\lceil\frac{2(n-2)}{3}\right\rceil \geqslant 2015 \Rightarrow n \geqslant 3024$.
Finally, we prove that there exists a set $A$ with 3024 elements that has exactly 2015 separators.
In fact,
$$
A=\left\{2 \times 6^{i}, 3 \times 6^{i}, 6^{i+1} \mid 0 \leqslant i \leqslant 1007\right\}
$$

satisfies $|A|=3024$, and $3 \times 6^{i}$ $(0 \leqslant i \leqslant 1007)$ and $6^{i}$ $(1 \leqslant i \leqslant 1007)$ are all separators.
In conclusion, the minimum value of $n$ is 3024.