TITLE: Number of subgroups of a $p$-group of index $p^k$
QUESTION [5 upvotes]: Let $p$ be a prime, let $n$ and $k$ be positive integers
and let $G$ be a group of order $p^n$.
Further, let $a_{p^k}$ denote the number of subgroups of $G$ of index $p^k$.
If $a_{p^k}$ is greater than 1 and not congruent to $p+1$ modulo $p^2$ --
does it follow that $p = 2$ and $G$ is either a dihedral group,
a quasidihedral group or a generalized quaternion group?

REPLY [10 votes]: It seems that the $p>2$ part of this was proved in
Kulakoff, A., Über die Anzahl der eigentlichen Untergruppen und der Elemente von gegebener Ordnung in $p$-Gruppen., Math. Ann. 104, 778-793 (1931). ZBL57.0146.03.
and the $p=2$ part in
Easterfield, T. E., An extension of a theorem of Kulakoff, Proc. Camb. Philos. Soc. 34, 316-320 (1938). ZBL0019.10802.