4. Arrange the numbers $2, 3, 4, 6, 8, 9, 12, 15$ in a row so that the greatest common divisor (GCD) of any two adjacent numbers is greater than 1. The total number of possible arrangements is ( ) kinds.
(A) 720
(B) 1014
(C) 576
(D) 1296
4. D.

First, divide the eight numbers into three groups:
I $(2,4,8)$, II $(3,9,15)$, III $(6,12)$.
Since the numbers in group I and group II have no common factors, the arrangement that satisfies the condition must be:
(1) After removing the numbers $6$ and $12$, the remaining numbers are divided into three parts and arranged (in sequence) as I, II, I or II, I, II. In this case, there are $2 \times 3! \times 3! \times 2 = 144$ ways to arrange these six numbers. And there are two different ways to place $6$ and $12$ at the intersection of different parts, totaling $2 \times 144 = 288$ ways.
(2) After removing the numbers $6$ and $12$, the remaining numbers are divided into two parts and arranged as I, II or II, I. In this case, there are $2 \times 3! \times 3!$ ways to arrange these six numbers. If $6$ and $12$ are both at the boundary between group I and group II, there are two ways to arrange them. Otherwise, only one is at the boundary, and the other has six possible positions, totaling $2 \times 3! \times 3! \times (2 + 2 \times 6) = 1008$.
Therefore, the total number of arrangements is $1008 + 288 = 1296$.