TITLE: Counting Conjugacy Classes: $A^6 = I$
QUESTION [6 upvotes]: This question is inspired by this earlier post.  The question that I'm interested in is as follows:

Let $S= \{A \in \mathbb{Q}^{k \times k} : A^6 = I \text{ and }A^n \ne I \text{ for any }0 < n < 6\}$. How many orbits under conjugation by $GL_k(\mathbb{Q})$ does $S$ contain?

Per the argument that I've given in the linked post, it suffices to list representatives in rational canonical form.  Thus, it is equivalent to enumerate the multisets of irreducible polynomials $\{p_1,\dots,p_n\}$ (which are the polynomials corresponding to companion matrix blocks) each of which divides $x^6-1$, whose degrees sum to $k$, and whose lcm divides $x^6 - 1$ but no polynomial of the form $x^n - 1$ for $n < 6$.
Of course, there is only one such multiset in the case of $k=2$, hence the answer to the linked question.  As $k$ grows things get trickier. For $k=5$, we have
$$
\{x^2 - x + 1, x \pm 1, x \pm 1, x\pm 1\}\\
\{x^2 + x + 1, x+1, x\pm 1, x\pm 1\}\\
\{x^2 - x + 1,  x^2 \pm x + 1 ,x \pm 1\}\\
\{x^2 + x + 1, x^2 + x + 1, x+1\}\\
$$
For a total of $14$ conjugacy classes.
How might one approach this problem in general?

REPLY [2 votes]: If $A\in M_n(\mathbb{Q}),A^6=I$, then $A$ is diagonalizable over $\mathbb{C}$ and its eigenvalues must be chosen among $1,-1$ or the couples $(j,j^2)$ or $(-j,-j^2)$ where $j=e^{2i\pi/3}$. Since the minimal polynomials of the above eigenvalues in $\mathbb{Q}[x]$ have degree $2$, our matrices are classified by the eligible sequences with elements in the box $ 1, -1, (j, j ^ 2), (- j, -j ^ 2) $, elements encoded by $(1,2,3,4)$, ordered by $1\leq 2\leq 3\leq 4$ with $length(1)=length(2)=1,length(3)=length(4)=2$. One condition is $\sum_i length(i)=k$. 
EDIT. The other condition is $order(A)=6$, that is, EITHER the element $4$ is in the considered sequence OR the couple $2,3$ is in the sequence.
Note that the number of similar classes is the same as in $M_n(\mathbb{R})$.
For example, when $k=4$, there are $7$ eligible sequences (then $7$ similar classes)
[1, 1, 4][1, 2, 3][1, 2, 4]                          [2, 2, 3][2, 2, 4][3, 4]                             [4, 4]
A rudimentary procedure (with computer) gives explicitly the list of the similarity classes and, of course, the number of classes.
For $k=5$, there are $12$ similar classes. 
[1, 1, 1, 4][1, 1, 2, 3][1, 1, 2, 4]                          [1, 2, 2, 3][1, 2, 2, 4][1, 3, 4]                           [1, 4, 4][2, 2, 2, 3][2, 2, 2, 4]                           [2, 3, 3][2, 3, 4][2, 4, 4]
For $k=6$, $20$ classes.
For $k=7$, $29$ classes.
These results are consistent with the counting Batominovski's formula (thanks to him for pointing out an error in the previous version of my post).