Formula for number of maximal subgroups of group of prime power order

Statement
Suppose $$G$$ is a group of prime power order where the underlying prime is $$p$$. Suppose $$r$$ is the minimum size of generating set for $$G$$. Then, the number of maximal subgroups of $$G$$ is equal to

$$\frac{p^r - 1}{p - 1} = p^{r-1} + p^{r-2} + \dots + p + 1$$

In particular, for $$r \ge 1$$, this number is congruent to 1 mod $$p$$.

Facts used

 * 1) uses::Equivalence of definitions of maximal subgroup of group of prime power order
 * 2) uses::Fourth isomorphism theorem
 * 3) uses::Equivalence of definitions of size of projective space

Proof outline
The key idea behind the proof is that the maximal subgroups of $$G$$ correspond, via the fourth isomorphism theorem, to maximal subgroups of the Frattini quotient $$G/\Phi(G)$$. The latter is an elementary abelian group of order $$p^r$$ and the number of maximal subgroups equals the number of codimension one subspaces, which is the indicated value by Fact (3).