Is there a group with $2$ generators having exactly $17$ subgroups of index three? I recently saw a fun problem from a past qualifying exam from Stanford. It is Problem 10, part (b) in this document. I will screenshot the problem and its solution here: 

My question is the following.

Does there exist a group $G$ which is generated by two elements, and
  has exactly 17 subgroups of index 3? If so, what kind of examples can one find? 

If the answer to the question is "No", then what is the largest value of $c$ such that there exists a group $G$ generated by $2$ elements, and having exactly $c$ subgroups of index $3$? All we know from the solution above is that $c\leq 17$.
Remark. I am tagging (finite-groups) since I assume the examples involved in this discussion will be finite groups. However, if there is an example of an infinite group $G$ which satisfies the desired properties, I am happy to learn about it as well!
 A: Let us consider the quotient $G$ of $F_2$ by the intersection of all kernels of homomorphisms $F_2\to S_3$ (this is called the relatively free group in the variety generated by $S_3$). Since this set of homomorphisms has cardinal $|S_3|^2$, $G$ is finite (of order $\le |S_3|^{|S_3|^2}=6^{36}$). 
In $G$, the set $T$ of elements of order dividing 3 is a subgroup, hence it's the unique 3-Sylow subgroup. Since any element has order dividing 6, it follows that $G/T$ is a 2-group of exponent 2, and hence we can write $G=A\ltimes T$ for some 2-Sylow $A$. Then $A$ is isomorphic to $|F_2|/|F_2|^2$, hence has order 4.
We can view $T$ as $(\mathbf{Z}/3\mathbf{Z})A$-module: the classification of modules is immediate in this context: there are 4 irreducible $A$-modules over $\mathbf{Z}/3\mathbf{Z}$: each of dimension 1 (order 3), and given by all 4 homomorphisms $A\to\{\pm 1\}$: the trivial one $T_0$, and the 3 nontrivial ones $T_1,T_2,T_3$. As a module, write $T=\bigoplus_{i=0}^3T_i^{n_i}$. We have $n_0=2$ because the abelianization of $G$ is isomorphic to $(\mathbf{Z}/6\mathbf{Z})^2$. By symmetry, we have $n_1=n_2=n_3$, and clearly $n_1\ge 1$. We have $n_1\le 1$. Indeed if by contradiction $n_1=2$, we get, as a quotient, $C_2\ltimes_{\pm 1}(\mathbf{Z}/3\mathbf{Z})^2$, whose nontrivial elements have order 2 and 3 (not 6). It easily follows that no pair generates it. 
Hence $G$ is isomorphic to $(\mathbf{Z}/3\mathbf{Z})^2\times (\mathbf{Z}/2\mathbf{Z})^2\ltimes(\mathbf{Z}/3\mathbf{Z})^3$, where the right actions splits as sum of all three nontrivial 1-dimensional irreducibles. (Thus it has order $2^23^5=972$).
[See this MO post for details about arbitrary relatively free groups in this variety]
It remains to count the number of subgroups of index 3. If $H$ is a subgroup of index 3, then $H\cap T$ has index 3 in $T$. It is normalized by a 2-Sylow subgroup, hence is normal. So we have to count the submodules of index 3 in $T$. These are (a) those subgroups of index 3 in $T=T_0^2\oplus T_1\oplus T_2\oplus T_3$ containing $T_1\oplus T_2\oplus T_3$ (there are 4 such subgroups), and (b), for each of $i=1,2,3$, the subgroup $T_0^2\oplus T_j\oplus T_k$ for $\{i,j,k\}=\{1,2,3\}$.
Next for given $H\cap T$, we have to count possibilities for $H$. That is, we have to count the number of subgroups of index 3 of the quotient $G/(H\cap T)$. In case (a), $G/(H\cap T)$ is abelian with a Sylow subgroup of order 3, so there a single candidate. In case (b), $G/(H\cap T)$ is isomorphic to $C_2\times S_3$, so has exactly 3 subgroups of order 3.
Hence the total number of subgroups of index 3 in $G$ is $4\times 1+3\times 3=13$.

Conclusion: a 2-generated group has at most 13 subgroups of index 3, and this is attained.

Also we can get further restrictions. For instance, the quotients of $G$ by minimal normal subgroups: either we kill a subgroup of order $3$ in $T_0^2$, or we kill one of the $T_i$: in such a quotient, in all cases, the number of subgroups of index 3 is 10 (so one cannot get 11 or 12). Listing all normal subgroups of $G$ and counting subgroups of index 3 in the quotient is not hard but I leave it to the reader: it gives the list of all possible values of the number of subgroups of index 3 in a 2-generated group.

Now looking at the notes in the post, here's an approach with the same idea as in the post, without going into the structure of the relatively free quotient, by distinguishing even actions and non-even actions. The number of even actions is the number of non-trivial homomorphisms $G\to \mathbf{Z}/3\mathbf{Z}$, which is bounded by 8. Two opposite such homomorphisms have the same kernel, so we obtain 4 subgroups in this way (which are normal).
Next, non-even actions are given by homomorphisms $G\to S_3$ whose image is not in $A_3$, and not of order 2, so there are $6^2-(3^2+3\times 3)=18$ such homomorphisms. Two such homomorphisms define the same subgroup of index 3 (say the stabilizer of 1) iff they have the same kernel and differ by post-composition by a transposition. Hence these yields $18/2=9$ non-normal subgroups of index 3.
This directly proves that the number of subgroups of index 3 in $F_2$ is 13 (4 normal, 9 non-normal) and this is an upper bound.

Such computations can be extended with more that 2 generators.

For instance, with $k$ generators: we have $(3^k-1)/2$ normal subgroups of index 3; also the number of homomorphisms $F_k\to S_3$ is $6^k$, those going into $A_3$ is $3^k$, those into a given subgroup of order 2 is $2^k$; those onto a given subgroup of order 2 is $2^k-1$, and hence those into some non-given subgroup of order 2 is $3(2^k-1)$. Hence the number of homomorphisms onto $S_3$ is $6^k-3^k-3(2^k-1)$. Again, two such homomorphisms yield the same subgroup of index 3 (stabilizer of 1) iff they're equal or differ by post-composition by transpositon $(2,3)$, and hence 

the number of non-normal subgroups of index 3 in $F_k$ is $(6^k-3^k-3(2^k-1))/2$, and 
the number of subgroups of index 3 in $F_k$ is $(6^k-3.2^k+2))/2$ (which is thus an upper bound for the number of subgroups of index $3$ in a $k$-generated group).

