I have a task: "Let $p$ be a prime number and let $G$ be a group with a subgroup $H$ of index $p$ in $G$. Let $S$ be a subgroup of $G$ such that $H\subset S\subset G$. Prove that $S = H$ or $S = G$."
So $[G : H] = p$ $\Rightarrow$ $|G| = |H|p$. Supposably, that $|H| = m$ and $|S| = g$. $\frac{|S|}{|H|} = \frac{g}{m}$. Hence $\frac{mp}{g} = \frac{mp}{\frac{g}{m}}$ $\Rightarrow$ $m = 1$ $\Rightarrow$ $|G| = p$.
I think that my mistake in this investigation $\frac{mp}{g} = \frac{mp}{\frac{g}{m}}$, but I cannot understand why this is must be false.
You don't need all those variables.
Moreover, the groups in question need not be finite.
Suppose $H$ is a subgroup of $G$ with $[G:H]=p$, for some prime $p$.
If $S$ is a subgroup of $G$ such that $H\subseteq S\subseteq G$, then $$p=[G:H]=[G:S]\cdot [S:H]$$
hence, either $[S:H]=1$, in which case, $S=H$, or $[G:S]=1$, in which case, $S=G$.