F:=FiniteField(q);
Fn<z>:=ext<F|n>;
P<x> := PolynomialRing(F);
A:={};
g := CheckPolynomial(C);
/* Find the roots of the check polynomial and then build the
cosets*/
for j:=1 to q^n-2 do
a:=Evaluate(g,z^j);
if (a eq 0) then
w := [j*q^i mod (q^n-1) : i in
[0..n-1] ];
A join:={{@w[k]: k in
[1..#w]@}};
end if;
end for;
/* If the cosets are not more than 3, then pick the smallest
representative from each of them*/
i:=[];
if (#A ge 4) then
print "The basic zeros are more than 3, please
try another code!";
else
i:=[a[1]:a in A];
i:=Sort(i);
end if;