Question: Counting how many polynomials are in specific Galois Group

Hello :)

So what I was trying to find Galois group for quartic polynomials in a form f=x^+a_3*x^3+a_2*x^2+a_1*x+a_0, where 0<=a_i<=2 and a_0 <>0. I get polynomials and galois groups - that's not an issue. Lets say I specifically need polynomials with group D_4 so I run script

restart;
A := {seq(0 .. 2)};
A0 := A minus {0};
m := numelems(A)^3*(numelems(A) - 1);
a := Iterator:-CartesianProduct(A0, A $ 3);
s := seq(x^4 + add(v[i]*x^(i - 1), i = 1 .. 4), v = a);
for k to m do
if irreduc(s[k]) = 'true' then print(f[k] = s[k], galois(s[k])); end if end do;

This one gives all list of polynomalias and their galois group.

for k to m do
    if irreduc(s[k]) = 'true' then if galois(s[k]) = ("4T3", {"D(4)"}, "-", 8, {"(1 3)", "(1 2 3 4)"}) then print(f[k] = s[k], galois(s[k])); end if; end if;
end do;

This one gives me a list of D_4 specifically. 
When 0<=a_i<=2 - there are not many polynomials so I cant count it by hand, but if I make a sequence larger there are too many polynomials to count them manually. So the question is how to count how many polynomials there are with a group D_4? Or lets say how do I count how many polynomials are in each group?
Thank you

Please Wait...