List all subgroups of the symmetry group of $n$-gon 
List all subgroups of the symmetry group of the regular $n$-gon.

If $n$ is prime, there are only $n+1$ subgroups: subgroup of all rotations and $n$ subgroups with $2$ elements (one reflection and rotation by zero degrees).
But if $n$ is composite, there are additional subgroups in the group of rotations, namely rotations by angle $\frac{\pi}{k},\ k|n$. Also there are subgroups containing rotations and reflections, number of which I can't found. I know that $s_\alpha s_\beta=r_{2(\alpha-\beta)}$, where $s_\alpha$ is a reflection by the line inlcined at an angle $\alpha$ to the horizontal axis. So if a subgroup contains $r_\alpha$ and $s_\beta$, it contains their product $s_{\beta - \frac{\alpha}{2}}$. 
What is the best way to count all subgroups for each $n$?
Update: I have found an group-theoretic answer at http://ysharifi.wordpress.com/2011/02/17/subgroups-of-dihedral-groups-1/
Later I will post the answer below.
 A: The dihedral group of order $2n$ is generated by rotation $x$ through an angle $\frac{2\pi}{n}$ and a "flip" or reflection $y$. (These satisfy the relations $x^n=y^2=1$ and $yx^i=x^{-i}y$). The subgroup generated by $x$ is isomorphic to $(\mathbb{Z}/n\mathbb{Z},+)$, which has a cyclic subgroup or order $d$ for each positive divisor $d$ of $n$. Likewise, corresponding to each of these cyclic subgroups is a dihedral subgroup of order $2d$, the symmetry group of the $d$-gon. These subgroups can also be represented by the generators:
$$
\left<x^{n/d}\right> \cong C_d \cong \left(\mathbb{Z}/d\mathbb{Z},+\right)
$$
$$
\left<x^{n/d},~y\right> \cong D_d
$$
Thus, up to isomorphism, there are $2\tau(n)$ subgroups of $D_n$. However, the union of each coset $y\left<x^{n/d}\right>x^i=\{yx^{i+jk}|0\leq k<d\}$ with $\left<x^{n/d}\right>$ , for $0\leq i<k=n/d$, is isomorphic to $D_d$, forming a distinct dihedral subgroup of $D_n$ within each isomorphism class (this is Yaghoub Sharifi's Lemma 3 in @sergey-filkin's link). Since for each $d|n$ there are $n/d$ such cosets, we get $\sum_{d|n}\frac{n}d=\sum_{d|n}d=\sigma(n)$ different dihedral subgroups and $\tau(n)$ different cyclic subgroups of $D_n$, or $\tau(n)+\sigma(n)$ total subgroups of $D_n$.
A: A formula is given at http://oeis.org/A007503. 
