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

Bill Allombert Bill.Allombert at math.u-bordeaux.fr
Mon Jul 27 16:32:10 BST 2020


On Mon, Jul 27, 2020 at 11:53:11AM +0800, Fawad Hayat wrote:
> 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.

It seems your question is how to loop over the integers.

You can do something like

gap> for n in [1..10] do Print(n); od;
12345678910

Cheers,
Bill.



More information about the Forum mailing list