Writing code in GAP

59 Views Asked by At

I want to write some GAP code that prints finite abelian groups that are the direct product of two cyclic groups. However, I want the order of the cyclic groups to have the condition that the gcd(,6)=1, where is the order of the cyclic groups and is greater than 1.

How would I go about doing this?

1

There are 1 best solutions below

4
On

Is this what your looking for?

n:=10;m:=10; #bounds on the sizes of the cyclic groups
for i in [1..n] do
    if GCD_INT(i,6)=1 then
        for j in [i..m] do
            if GCD_INT(j,6)=1 then
                Print(IdGroup(DirectProduct(CyclicGroup(i),CyclicGroup(j))));
            fi;
        od;
    fi;
 od;

It prints the group id from the library SmallGrp, see also the function StructureDescription(G);