This is Exercise 6.29 from An Introduction to the Theory of Groups by J. J. Rotman:
Show that the following groups are indecomposable: $\mathbb{Z}$; $\mathbb{Z}^{p^n}$; $\mathbb{Q}$; $S_n$; $D_{2n}$; $\mathbf{Q}_n$; simple groups; nonabelian groups of order $p^3$; $A_4$; the group $T$ of order $12$.
But is $D_{2n}$ really indecomposable? I think $D_{4}\cong\mathbb{Z}_2\times\mathbb{Z}_2$ and $D_{12}\cong S_3\times\mathbb{Z}_2$. Is this a typo?
This leads to the question:
For which $n\geq3$ is $D_{2n}$ indecomposable?
I think this happens iff $n\not\equiv 2\pmod4$. Here is my proof.
Let $D_{2n}=\left<a,b\mid a^n=b^2=1,bab=a^{-1}\right>$ be decomposable. The normal subgroups of $D_{2n}$ are of the form $\left<a^k\right>$, $\left<b,a^2\right>$, $\left<ba,a^2\right>$, where the latter two subgroups are proper iff $2\mid n$. Since $D_{2n}$ is not abelian, it cannot be the direct product of two subgroups of the form $\left<a^k\right>$, therefore $2\mid n$ and $|\left<b,a^2\right>|=|\left<ba,a^2\right>|=n$. But $\left<b,a^2\right>\cap\left<ba,a^2\right>\neq1$, so $D_{2n}$ must be $\left<b,a^2\right>\times\left<a^k\right>$ or $\left<ba,a^2\right>\times\left<a^k\right>$ for some $k$. By order considerations we see $k=n/2$. Then $\left<b,a^2\right>\cap\left<a^{n/2}\right>=1$ or $\left<ba,a^2\right>\times\left<a^{n/2}\right>=1$ iff $2\nmid n/2$, i.e., $n\not\equiv 2\pmod4$. On the other hand, we have $D_{2n}\cong D_{n}\times\mathbb{Z}_2$ when $n\equiv2\pmod4$, and the proof is complete.
Is my proof correct?