An erroneous application of the Counting Theorem to a regular hexagon? I'm trying to count the unique orbits of a regular hexagon such that each vertex is either Black or White and each edge is either Red, Gree, or Blue. The group I've chosen to act on the hexagon is the dihedral group $D_7$, $$\{e,r,r^2,r^3,r^4,r^5,r^6,s,rs,r^2s,r^3s,r^4s,r^5s,r^6s\}$$ where $r$ is a rotation by $\frac{\pi}{3}$, and $s$ a reflection in the axis connecting two opposite vertices or the midpoints of two opposite edges. When chopped up, I get the following partition into conjugacy classes: $$\{e\} \hspace{0.5cm} \{r,r^6\}\hspace{0.5cm} \{r^2,r^5\}\hspace{0.5cm} \{r^3,r^4\}\hspace{0.5cm}\{s,r^2s,r^4s,r^6s\}\hspace{0.5cm} \{rs,r^3s,r^5s\}$$
Taking the first element of each conjugacy class as the representative, I then go about counting the permutations that are left fixed by that representative. Here's my count (note, $X^g$ denotes the set of all regular hexagons left fixed by group element $g$): $$\begin{align*}
|X^e|&=3^6\times 2^6 & |X^r|&=3\times 2 & |X^{r^2}|&=3^2\times 2^2\\ |X^{r^3}|&=3^3\times 2^3 & |X^s|&=3^4\times 2^3 + 3^3\times 2^4 & |X^{rs}|&=3^3\times 2^4 + 3^4\times 2^3 \end{align*}$$
Notice that the order of the last two sets, $X^s$ and $X^{rs}$, are sums: one addend counts the reflections through opposite vertices and the other through midpoints of opposite sides. When I apply the Counting Theorem (aka Burside's Lemma?) I obtain $$\frac{1}{14}[3^6\times 2^6 + 2(3\times 2) + 2(3^2 \times 2^2) + 2(3^3\times 2^3) + 4(3^4\times 2^3 + 3^3 \times 2^4) + 3(3^3\times 2^4 + 3^4 \times 2^3)]$$ and it is here I stumbled when I saw this product is not an integer.

For  future reference  I would  like to  document how  we can  do this
calculation  using a  cycle index.   The key  observation here  is the
following: the  cycle structure of  a rotation (but not  a reflection)
acting  on  the  vertices  and   edges  is  the  same  for  edges  and
vertices. So we  may compute the cycle index  by duplicating the cycle
structure  of the  terms of  the ordinary  cycle index  acting  on the
vertices. Do the rotations first. There is the identity which yield
$$a_1^6 b_1^6.$$
A rotation that takes zero to one or five yields
$$2 a_6 b_6.$$
A rotation that takes zero to two or four yields
$$2 a_3^2 b_3^2.$$
The rotation that takes zero to three yields
$$a_2^3 b_2^3.$$
For the reflections  we get reflections about an  axis passing through
two opposite vertices  to get (note the different  cycle structure for
the vertices and the edges)
$$3 a_1^2 a_2^2 b_2^3.$$
Then there are reflections about an axis passing through the midpoints
of  two opposite edges  which yield  (once again  we have  a different
cycle structure for vertices and edges)
$$3 a_2^3 b_1^2 b_2^2.$$
Now we have two colors for  the vertices and three for the edges which
by Burnside must be constant on the cycles. This yields
$$\frac{1}{12}
\left(6^6 + 2\times 6 + 2\times 6^2 + 6^3 
+ 3 \times 2^4 3^3 + 3 \times 2^3 3^4\right).$$
This yields for the desired end result the value
$$4183.$$
It  was  not  practicable  to  verify  this  with  Maple  as  resource
consumption (time,  space) was unacceptable. Perl seems  to cope quite
well.

#! /usr/bin/perl -w
#

sub convert {
    my ($val, $base, $len) = @_;

    my @res;

    for(my $pos = 0; $pos < $len; $pos++){
        my $digit = $val % $base;

        push @res, $digit;
        $val = ($val - $digit) / $base;
    }

    return \@res;
}

MAIN : {
    my ($idx2, $idx3, $d2, $d3);

    my %orbits;

    for(my $idx2 = 0; $idx2 < 2**6; $idx2++){
        $d2 = convert $idx2, 2, 6;
        for(my $idx3 = 0; $idx3 < 3**6; $idx3++){
            $d3 = convert $idx3, 3, 6;

            my @interl;

            for(my $pos = 0; $pos < 6; $pos++){
                push @interl, 
                $d2->[$pos], $d3->[$pos];
            }

            my (%orbit, $entry, $refent);

            for(my $rot=0; $rot<12; $rot+=2){
                $entry = 
                    [@interl[$rot..11],
                     @interl[0..$rot-1]];
                $orbit{join('-', @$entry)} = 1;
            }

            for(my $refl=0; $refl<12; $refl+=4){
                $entry = 
                    [@interl[$refl..11],
                     @interl[0..$refl-1]];

                $refent =
                    [$entry->[0], 
                     reverse(@$entry[1..11])];
                $orbit{join('-', @$refent)} = 1;

                $refent =
                    [$entry->[2], 
                     $entry->[1], 
                     $entry->[0],
                     reverse(@$entry[3..11])];
                $orbit{join('-', @$refent)} = 1;
            }

            $orbits{join('|', sort(keys %orbit))} = 1; 
        }
    }

    print scalar(keys %orbits);

    printf " (%d)\n",
    (6**6
     + 2 * 6
     + 2 * 6**2
     + 6**3
     + 3 * 2**4 * 3**3
     + 3 * 2**3 * 3**4)/12;

    1;
}

Remark. We could adapt the join statements above to use empty separators which however reduces readability of the data structure during debugging.
