Solution (source code)

= Solution

By <Lagrange's theorem>, a <stabilizer subgroup> of $G$ has order $p^j$ for some $0\leq j\leq n$. The <orbit-stabilizer theorem> therefore gives
$$
|Y|=p^{n-j}.
$$
Thus an <orbit of a group action> either has one element or has size divisible by $p$, even if the acted-on set is infinite.

Apply this to the <conjugation action>. Its singleton <orbits of a group action> are the elements of the <centre of a group>, while every other orbit has size divisible by $p$. Partitioning the finite <group> into these orbits gives the <class equation>, and hence
$$
|Z(G)|\equiv|G|\equiv0\pmod p.
$$
Since the identity belongs to $Z(G)$, its order is positive and divisible by $p$. Consequently
$$
\boxed{|Z(G)|\geq p>1.}
$$
Now suppose that $|Z(G)|=p^{n-1}$. It is then proper, so choose $x\notin Z(G)$. The <centralizer>
$$
C_G(x)=\{g\in G:gx=xg\}
$$
is a <subgroup>: commuting with $x$ is preserved by multiplication and inverses. It contains $Z(G)$ and also $x$, so $|C_G(x)|>|Z(G)|=p^{n-1}$. By <Lagrange's theorem>, its order is a power of $p$ dividing $p^n$, forcing $C_G(x)=G$. But that would make $x$ central, a contradiction. Therefore
$$
\boxed{|Z(G)|\ne p^{n-1}.}
$$