TITLE: Values attained by $|G/Z(G)|$?
QUESTION [32 upvotes]: So I was working through some problems in a book on $p$-groups and noticed that
$p$-groups have some really nice properties. So I started computing what the values of $|G/Z(G)|$ for $p$-groups. I decided to see what it would be and found that it cannot attain the value of $p$. I am interested in the whethere $|G/Z(G)|$ can attain all other powers of $p$?
In general I am interesting in the values that $|G/Z(G)|$ can achieve.
Any help is greatly appreciated.

REPLY [5 votes]: The result you found that $|G/Z(G)|$ cannot be prime is essentially the only restriction for $p$-groups:

For every $k\geq 2$ and every $p\in\mathbb{P}$ there exists a finite  $p$-group $G$ such that $|G/Z(G)|=p^k$.

Proof: Let $q:=p^{k-1}$ and consider the matrix group $\begin{pmatrix}1&\mathbb{F}_p&\mathbb{F}_q \\ &1&\mathbb{F}_q \\ && 1\end{pmatrix}$ which has order $p^{2k-1}$ and center of order $p^{k-1}$ (the top right corner) which gives us a center quoient of order $p^k$ as desired. QED.
Observe that by taking direct products of such groups one can easily write down examples of $|G/Z(G)|=n$ for every natural number $n>1$ in which every prime factor that occurs, occurs at least twice. This is because $Z(G_1\times G_2)=Z(G_1)\times Z(G_2)$.