Solution (source code)

= Solution

A <constructible regular polygon> can be translated, rotated, and rescaled by constructible operations to one inscribed in the unit <circle> with a vertex at $(1,0)$. Thus the real and imaginary parts of $\zeta=e^{2\pi i/p}$ are constructible. Part (c) puts both in a real <field> $K$ of <degree> $2^n$ over $\mathbb Q$. Consequently $\zeta\in K(i)$, and $[K(i):\mathbb Q]=2^{n+1}$ because $K\subset\mathbb R$.

For <prime> $p$, the supplied irreducibility of $1+x+\cdots+x^{p-1}$ shows that $[\mathbb Q(\zeta):\mathbb Q]=p-1$. The intermediate-field tower law implies that $p-1$ divides $2^{n+1}$. Every positive divisor of a <power of two> is a <power of two>, so
$$
\boxed{p=2^r+1\quad\text{for an integer }r\geq0.}
$$
This necessary condition includes $p=2$ with $r=0$. It does not assert sufficiency for arbitrary <integers> of this form.