Solution (source code)

= Solution

The primitive root $\zeta_n$ is a zero of the cyclotomic <polynomial> $\Phi_n$, of degree $\varphi(n)$. Its minimal <polynomial> over $K$ divides $\Phi_n$, so
$$
[K(\zeta_n):K]\mid\varphi(n),
$$
where divisibility also follows from the embedding of the Galois <group> of the <cyclotomic field> into $(\mathbb Z/n\mathbb Z)^\times$. Over $\mathbb Q$, Gauss's irreducibility theorem for cyclotomic <polynomials> says that $\Phi_n$ is irreducible. Therefore
$$
\boxed{[\mathbb Q(\zeta_n):\mathbb Q]=\deg\Phi_n=\varphi(n).}
$$