4. There are three mathematics courses: Algebra, Geometry, and Number Theory. If no two of these courses can be scheduled consecutively, then a student has $(\quad)$ different ways to arrange the 6 periods in one day.
(A) 3
(B) 6
(C) 12
(D) 18
(E) 24
4. E.

If no two courses can be scheduled consecutively, the three math classes can be arranged in periods $1, 3, 5$; periods $1, 3, 6$; periods $1, 4, 6$; and periods $2, 4, 6$, for a total of four scenarios. Each scenario has
$$
3!=3 \times 2 \times 1=6 \text{ (ways). }
$$

Therefore, there are a total of $4 \times 3!=4 \times 3 \times 2 \times 1=24$ different scheduling methods.