Finite index subgroups of surface groups

It is not hard to see (say from the perspective of covering spaces) that there are a finite number of subgroups of a fixed finite index $n$ in a finitely generated free group $F_n$. Given a closed oriented surface $F$, are there a finite number of subgroups of $\pi_1(F)$ of a given index? If so is there a formula for this number?

@Eric Wofsey has already explained why the number of subgroups of a given index is finite in a finitely generated group, so I'll just attempt to reproduce the formula for counting them.

There is a kind of recursive formula, depending on the genus $g$ of $F$. This comes from Chapter 14 of the book "Subgroup Growth", by Lubotzky and Segal. who attribute the result to A.D. Mednykh.

Let $a_n$ denote the number of subgroups of index $n$ in $\pi_1(F)$. Then $$a_n = \frac{1}{(n-1)!}h_n - \sum_{k=1}^{n-1}\frac{1}{(n-k)!}h_{n-k}a_k,$$ where $h_n$ is the number of homomorphisms from $\pi_1(F)$ to the symmetric group $S_n$. (In fact, this much is independent of $g$, and holds for any group in place of $\pi_1(F)$.)

But, for surface groups $F$ of genus $g$ (either orientable or non-orientable), there is a formula for $h_n$ that relies on the representation theory of the symmetric group: $$h_n = (n!)^{2g-1}\sum_{\chi\in\operatorname{Irr}(S_n)}\chi(1)^{2-2g}.$$ Here, $\operatorname{Irr}(S_n)$ denotes the set of irreducible characters of the symmetric group $S_n$.

Assuming I didn't make any mistake in my code, here are expressions in $g$ for the first few values of $n$ (of course $a_1 =1$ for any $g$):

> a := proc(n,g)
>   local   k;
>   (n!)^(2*g-1) * +( op( map( $ @ op, CharacterDegrees( CharacterTable( Symm( n ) ) ) ) ^~ (2-2*g) ) ) > end proc: > for i from 2 to 5 do print(simplify(a(i,g))) end: g 4 - 1 g g 36 9 g --- + ---- - 2 4 + 1 6 3 g g g g 576 144 64 36 g g g ---- + ---- + --- - --- - 9 - 16 + 3 4 - 1 72 36 8 2 g g g g g g g g 14400 900 23 576 400 25 144 7 64 36 5 9 g (2 + 2 g) ------ + ---- - ------- + ---- - ------- - ----- - --- + ---- + 3 16 - 2 + 1 1440 90 288 80 36 8 6 3  (Even the simplified expressions get a bit messy after that.) Note that it is fairly easy to see directly why$a_2 = 4^g - 1$. Any subgroup of index$2$is normal, so$a_2$just counts the number of homomorphisms from$\pi_1(F)$onto a cyclic group$C_2$of order$2$. It is clear from the defining relation for$\pi_1(F)$that sending any non-empty subset of the$2g$generators to the nontrivial element of$C_2$(and the others to$1$) gives rise to a (surjective) homomorphism, which yields the value$a_2 = 2^{2g} - 1 = 4^g - 1$. More generally, if$G$is any finitely generated group, then it has only finitely many subgroups of any given index. Indeed, if$H\subseteq G$is a subgroup of index$n$, then it is the stabilizer of a point in an action of$G$on a set with$n$elements (namely, the cosets of$H$). But there are only finitely many such actions since$G$is finitely generated, so there can only be finitely many such subgroups$H$. I don't know how to count how many subgroups there are of a given index when$G=\pi_1(F)\$.