Here is exercise 7.B.4 from 'A Book of Abstract Algebra' by Charles C. Pinter.
A solution to this using a C# program is posted.
Is there another good approach using a computer program?
Any language is welcome.
The subgroup of $S_5$ generated by
$ f = \begin{pmatrix}1 & 2 & 3 & 4 & 5\\2 & 1 & 3 & 4 & 5\end{pmatrix} \qquad g = \begin{pmatrix}1 & 2 & 3 & 4 & 5\\1 & 2 & 4 & 5 & 3\end{pmatrix} $
has six elements. List them, then write the table of this group:
$\varepsilon = \begin{pmatrix}1 & 2 & 3 & 4 & 5\\1 & 2 & 3 & 4 & 5\end{pmatrix}$
$f = \begin{pmatrix}1 & 2 & 3 & 4 & 5\\2 & 1 & 3 & 4 & 5\end{pmatrix}$
$g = \begin{pmatrix}1 & 2 & 3 & 4 & 5\\1 & 2 & 4 & 5 & 3\end{pmatrix}$
$h = \begin{pmatrix}1 & 2 & 3 & 4 & 5\\ \, \end{pmatrix}$
$k = \begin{pmatrix}1 & 2 & 3 & 4 & 5\\ \,\end{pmatrix}$
$l = \begin{pmatrix}1 & 2 & 3 & 4 & 5\\ \,\end{pmatrix}$
$ \begin{array}{c|ccc} \circ & \varepsilon & f & g & h & k & l \\ \hline \varepsilon \\ f \\ g \\ h \\ k \\ l \end{array} $

