[GAP Forum] needs help in programming for an integral power.

Fawad Hayat fawadhayat05 at gmail.com
Mon Jul 27 04:53:11 BST 2020


Hello everbody,

I’m writing a program in GAP for group elements, that any two elements of a
group G are an integral power of one another, i.e., for any x, y ∈ G, then x
n=y or yn=x, where n is any positive integer. But it has some problems. *I
don’t know where to write the value “n.”*  I’ll be very grateful if it can
be written more simply.



f := f unction(G)

local x; y; M; MM; i; j; s; d; n;

M:= []; MM:= []; s:= 0; d:= [];

*for n in Integers do*

for x in Elements(G) do

for y in Elements(G) do

if x^n = y  then

Add(M; 1);

else

Add(M; 0);

fi;

od;

od;

Add(MM;M); M := [];

od;

Print(MM);

for i in MM do

for j in i do

s:= s + j;

od;

Add(d; s); s := 0;

od;

Print(d);

return;

end;


More information about the Forum mailing list