TITLE: In GAP, How can I check whether a given group is a direct product?
QUESTION [5 upvotes]: I'm working with GAP and I want to make some check through all small group up to given size. For direct product groups the result is depend on the groups it composed of, so I don't want to waste time on such groups. Is there a built-in option to check whether a group is a (not trivial) direct product?

REPLY [7 votes]: There is the command StructureDescription(G) which gives a name for the group $G$ and could tell you whether $G$ is a direct product or not. However, it just gives you a string and not the subgroups giving the decomposition.
But in the algorithm of StructureDescription (described here) a decomposition is found at some point. According to the answer given by Alexander Konovalov here, the command StructureDescription uses the undocumented method DirectFactorsOfGroup to do this.
So you can use
DirectFactorsOfGroup(G);

which returns a list $[G_1, \ldots, G_n]$ such that $G = G_1 \times \cdots \times G_n$. I suppose this will always return $G_i$ which are directly indecomposable, since the algorithm of StructureDescription states that we "Decompose G into a direct product of irreducible factors.".