A non-abelian $p$-group $G$ There is some facts about finite non abelian $p$-groups over the site. For example, when $n=3$: Nonabelian groups of order $p^3$. I have found the following problem in my very old works unsolved, claiming:

$G$ is a finite non-abelian $p$-group, $|G|=p^n$. Then $|G'|\neq p^{n-1}$

When $p=3$ we start with $Z(G)\neq 1$ to show that $|Z(G)|=|G'|=p$. But in above problem it seems to me that induction on all $p$-groups (finite and non abelian) with orders less than $n$ may be applicable. In fact for such a group, $|G|=p^n$, we have:$$|Z(G)|=p, p^2,... \mathrm{or}\ p^{n-2}$$Is my approach valid? Thanks.
 A: We can assume $n > 2$ because otherwise $G$ is abelian. In $p$-groups, there is a normal subgroup of every possible order. In particular, there is a normal subgroup $N$ of order $p^{n-2}$. Then $G/N$ is abelian and $N$ contains $G'$, proving the statement.
A: If $M$ is a maximal subgroup of the finite $p$-group $G$, then $M$ is normal in $G$ and the quotient is an abelian group of order $p$ ($M$ is properly contained in its normalizer, but it is maximal, so $G$ is its normalizer).
In particular, $G' \leq M$ for every maximal subgroup $M$.  Now suppose $G/G'$ has order $p$, so that $G/G' = \langle zG' \rangle$ for some $z \in G$.  Then if $z \in G'$, $G=G'=1$ (which is abelian, so irrelevant). Otherwise $z \notin G'$. If $\langle z \rangle = G$, then $G$ is abelian (so irrelevant). Hence $\langle z \rangle < G$ must be contained in some maximal subgroup $M$. But then both $z$ and $G'$ are contained in $M$, so $G = \langle z, G' \rangle \leq M < G$ is a contradiction.
In other words, if $G/\Phi(G)$ is cyclic, then $G$ is cyclic. In a $p$-group, $\Phi(G) = G^p G'$.
