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?