I asked a very similar question [here](https://mathoverflow.net/q/308340/22512) and got a wonderful answer. But now I need to change the question slightly (this is the last question like this, I promise).


I would like to characterize when $(\mathbb{Z}/p\mathbb{Z})^n \rtimes (\mathbb{Z}/q\mathbb{Z})^2$ is a centerless group generated by two elements. Here, $p$ and $q$ are distinct primes (you can assume both are odd if relevant).


There was a nice answer when the second factor was cyclic, and I’m wondering how this changes it.


Thanks very much!



When is the semidirect product of $(Z/pZ)^n$ and $(Z/qZ)^2$ generated by two elements?
Here is a proof of YCor's claim that the group is $2$-generated if and only if $V:=(Z/pZ)^n$ is isomorphic as a $(Z/qZ)^2$-module to a direct sum of distinct nontrivial irreducible modules.


For the "only if" part it is sufficient to consder the case when $V = W \oplus W$ is a direct sum of two isomorphic modules, and to prove that $G$ is not $2$-generated in that case.


Suppose for a contradiction that $G$ is $2$-generated. Then the two generators must have the form $xv$ and $yw$, where $\langle x, y \rangle \cong (Z/qZ)^2$ is a complement in the semidirect product, and $v,w \in V$. Since $V$ is assumed to be nontrivial, $x$ and $y$ cannot both act trivially on $V$, so suppose that $x$ does not. Then $xv$ has order $q$ and is conjugate to $x$, so we may assume that $v=1$. But any element in $V$ is contained in a $(Z/qZ)^2$-submodule of $V$ isomorphic to $W$, so $\langle x,yb \rangle \le \langle x,y,b \rangle \ne G$, contradiction.


Conversely, suppose that $V \cong \oplus\_{i=1}^k V\_i$, with $V\_i$ pairwise non-isomorphic $(Z/qZ)^2$-submodules, and let $0 \ne v\_i \in V\_i$.


Again by nontriviality, $x$ and $y$ cannot both act non-trivially on any $V\_i$, and we can order the $V\_i$ such that, for some $j$ with $0 \le j \le k$, $y$ acts nontrivially on $V\_1,\ldots,V\_j$ and $x$ acts nontrivially on $V\_{j+1},\ldots,V\_k$.


Let $H= \langle xv\_1\cdots v\_j, yv\_{j+1}\cdots v\_k \rangle \le G$. We claim that $H=G$.


To see this, observe that the commutator
$$ [ xv\_1\cdots v\_j, yv\_{j+1}\cdots v\_k] = [v\_1,y]\cdots[v\_j,y][x,v\_{j+1}] \cdots [x,v\_k], $$
which is a product of nontrivial elements, one from each $V\_i$. The submodule of $V$ generated by this element projects nontrivially onto each $V\_i$, and so it must be equal to $V$. Hence $V \le H$, so $H=G$ as claimed.


I think that if you allow trivial irreducible submodules of $V$ then, as in the previous problem, you can also have up to two of these in a $2$-generated group.


*PS*: I see that I missed the fact mentioned by YCor that $Z(G)=1$ implies that $V$ must be a faithful module.


