# Total number of subgroups of a group

Is there a way to calculate the total number of subgroups of a group?

I can imagine that for example if $G=D_n$ is the dihedral group or $G=S_n$ the symmetric group then there exists a formula to calculate the total number of subgroups.

The reason why I started to think about this question is because I was trying to find all subgroups of $D_4$ (the square).

And I found some but I want to prove that I found all of them.

So if the answer is no to the question above then I'd be equally happy with a way of being sure that given a collection of subgroups to determine that there cannot be more.

You might be interested in this MO thread, which basically says the answer is no. However, it also contains the nice fact that any subgroup is generated by at most $\log_2(|G|)$ elements, which does limit the search space somewhat.
For dihedral groups, you can use a much more elementary counting argument: either the group is cyclic (and these are easily counted) or it contains a reflection. If we call one such reflection $r$... can you finish from here?
The total number of subroups $D_{n}$ are $$\tau(n)+\sigma(n)$$ Where $\tau(n)$ is the number of divisors of n and $\sigma(n)$ is the sum of divisors of $n$