Bill Allombert on Thu, 26 Jan 2023 13:10:02 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: How to define Group (Z/nZ)*


On Thu, Jan 26, 2023 at 03:18:11AM -0800, Thomas D. Dean wrote:
> How do I define the multiplicative group (Z/nZ)* and display its members? I
> saw znstar(n). Using G=znstar(7), how do I display G's members?
> 
> How do I define the additive group (Z/nZ)+ and display its members?
> 
> I want to create groups and look at Cayley tables.

PARI is not a group theoretic software. Abelian groups are treated as Z-modules.
You would probaby find GAP (www.gap-system.org) more intuitive.

To answer your question:
An abelian group (in multiplicative notation) in PARI/GP has two components:
? G.cyc
%10 = [6]
? G.gen
%11 = [Mod(3,7)]

Let k=#G.cyc.
The set of elements is the set G.gen[1]^e1 * ... * G.gen[k]^ek for
all choices of e1,...,ek such that 0<=e1<G.cyc[1],...,0<=ek<G.cyc[k].

you can print them as follow:

? forvec(v=[[0,c-1]|c<-G.cyc],print(factorback(G.gen,v)))
1
Mod(3,7)
Mod(2,7)
Mod(6,7)
Mod(4,7)
Mod(5,7)

or for 42

? G=znstar(42)
%14 = [12,[6,2],[Mod(31,42),Mod(29,42)]]
? forvec(v=[[0,c-1]|c<-G.cyc],print(factorback(G.gen,v)))
1
Mod(29,42)
Mod(31,42)
Mod(17,42)
Mod(37,42)
Mod(23,42)
Mod(13,42)
Mod(41,42)
Mod(25,42)
Mod(11,42)
Mod(19,42)
Mod(5,42)

But as far as number theory is concerned, this is pointless, you could just as well do
? for(i=1,42,if(gcd(i,42)==1,print(Mod(i,42))))
Mod(1,42)
Mod(5,42)
Mod(11,42)
Mod(13,42)
Mod(17,42)
Mod(19,42)
Mod(23,42)
Mod(25,42)
Mod(29,42)
Mod(31,42)
Mod(37,42)
Mod(41,42)

Cheers,
Bill.