Let $G$ be a finite $p$-group. Since we can embed $Z\_2(G)/Z(G)$ in $Hom(G,Z(G))$, we have $d\_2 \leq d(G)d(Z(G))$; where $d\_2(G)=d(Z\_2(G)/Z(G))$ and $d(G)$ denotes the minimal number of generators of $G$. The question is, does the equality $d\_2 = d(G)d(Z(G))$ imply that $Z(G)$ is cyclic? 



Generators of p-groups
OK, here is an example of a group $Q$ of class 3 and order $p^{17}$, which will work for $p \ge 5$. We have $d(Q)=5$, $d(Z(Q)) = 2$, $d(Z\_2(Q))/Z(Q)) = 10$, with $Z(Q) = \langle Q.16, Q.17 \rangle$ and $Z\_2(Q) = \langle Q.6,\ldots,Q.17 \rangle$. All generators have order $p$ - in fact $Q$ has exponent $p$. All pairs of generators commute except for those in the list below. (This is Magma output.)



```
Q.2^Q.1 = Q.2 * Q.6, 
Q.3^Q.1 = Q.3 * Q.7, 
Q.3^Q.2 = Q.3 * Q.8, 
Q.4^Q.1 = Q.4 * Q.9, 
Q.4^Q.2 = Q.4 * Q.10, 
Q.4^Q.3 = Q.4 * Q.11, 
Q.5^Q.1 = Q.5 * Q.12, 
Q.5^Q.2 = Q.5 * Q.13, 
Q.5^Q.3 = Q.5 * Q.14, 
Q.5^Q.4 = Q.5 * Q.15, 
Q.6^Q.1 = Q.6 * Q.16, 
Q.7^Q.1 = Q.7 * Q.17, 
Q.8^Q.2 = Q.8 * Q.16, 
Q.9^Q.2 = Q.9 * Q.17, 
Q.10^Q.1 = Q.10 * Q.17, 
Q.10^Q.3 = Q.10 * Q.16, 
Q.11^Q.2 = Q.11 * Q.16, 
Q.11^Q.3 = Q.11 * Q.17, 
Q.12^Q.4 = Q.12 * Q.16, 
Q.13^Q.4 = Q.13 * Q.17, 
Q.14^Q.5 = Q.14 * Q.16, 
Q.15^Q.1 = Q.15 * Q.16, 
Q.15^Q.2 = Q.15 * Q.17, 
Q.15^Q.5 = Q.15 * Q.17.

```

The conditions that you listed on such an example just mean that examples are moderately large, and so are more difficult to construct. They do not provide any genuine evidence that there are no such examples. There was a conjecture about $p$-groups called the class-breadth conjecture that was open for a long time, but as soon as it became possible to use computers to study larger groups, it became relatively easy to find counterexamples.


