Thank you Sir, for your kind response. Actually, we have a definition of the power graph of a group G, “Two elements x, y of G being adjacent iff one element is a power of the other, i.e., x^n=y or y^n=x.” So I would like to find all those elements which satisfy this condition. In The following program I need the set M and MM which I defined. If the following program have some problems please correct that for me, I’ll be very grateful to you.
Best regards, Fawad. On Tue, Jul 28, 2020 at 4:00 PM <forum-requ...@gap-system.org> wrote: > Send Forum mailing list submissions to > forum@gap-system.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.gap-system.org/mailman/listinfo/forum > or, via email, send a message with subject or body 'help' to > forum-requ...@gap-system.org > > You can reach the person managing the list at > forum-ow...@gap-system.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Forum digest..." > > > Today's Topics: > > 1. Re: needs help in programming for an integral power. (Max Horn) > 2. Re: needs help in programming for an integral power. > (Bill Allombert) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 27 Jul 2020 13:39:07 +0200 > From: Max Horn <h...@mathematik.uni-kl.de> > To: Fawad Hayat <fawadhaya...@gmail.com> > Cc: GAP Forum <forum@gap-system.org> > Subject: Re: [GAP Forum] needs help in programming for an integral > power. > Message-ID: > <6c62711e-c134-4138-bf5f-e26bee3c4...@mathematik.uni-kl.de> > Content-Type: text/plain; charset=utf-8 > > Dear Fawad Hayat, > > from you description it is not really clear what you want to compute; nor > does your pseudo code snippet make much sense to me. > > > On 27. Jul 2020, at 05:53, Fawad Hayat <fawadhaya...@gmail.com> 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. > > If you really just want to check for a given group G whether > > \forall x,y\in G \exists n>0: x^n=y or y^n=x > > Then you don't need to write length GAP programs for this: You can easily > characterize these groups by hand: they certainly must be cyclic; now you > just need to check which cyclic groups satisfy this property (I'll leave it > to you to figure out which exactly, it's a fun exercise). > > Or perhaps you really want to compute something else; then you should try > to carefully write up what it is you really are asking, mathematically, so > that we have a chance of understanding and helping. > > Best regards > Max Horn > > > > 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; > > _______________________________________________ > > Forum mailing list > > Forum@gap-system.org > > https://mail.gap-system.org/mailman/listinfo/forum > > > > > ------------------------------ > > Message: 2 > Date: Mon, 27 Jul 2020 17:32:10 +0200 > From: Bill Allombert <bill.allomb...@math.u-bordeaux.fr> > To: forum@gap-system.org > Subject: Re: [GAP Forum] needs help in programming for an integral > power. > Message-ID: <20200727153210.GE25720@yellowpig> > Content-Type: text/plain; charset=utf-8 > > 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. > > > > ------------------------------ > > _______________________________________________ > Forum mailing list > Forum@gap-system.org > https://mail.gap-system.org/mailman/listinfo/forum > > > End of Forum Digest, Vol 199, Issue 10 > ************************************** > _______________________________________________ Forum mailing list Forum@gap-system.org https://mail.gap-system.org/mailman/listinfo/forum