Function Resource

Function Repository Resource:

MultiplicativeGroup

Source Notebook

Calculate the multiplicative group of integers modulo n

Contributed by: Naman T.

ResourceFunction["MultiplicativeGroup"][n]

calculates the multiplicative group of integers modulo n.

Details and Options

The multiplicative group of integers modulo n, denoted Un, consists of integers 1<=a<n such that gcd(a,n)=1. Its order is given by EulerPhi[n].
ResourceFunction["MultiplicativeGroup"][n] uses the fundamental theorem of finite abelian groups.
For n equal to powers of 2, we have U2U4C2 and U2kC2×C2k-2 for k>=3.
For n=piki, we have UnC(p-1)pk-1.
For , we have .
ResourceFunction["MultiplicativeGroup"][n] evaluates to an appropriate AbelianGroup, CyclicGroup, or more.

Examples

Basic Examples (5) 

Find the multiplicative group of integers modulo 5:

In[1]:=
ResourceFunction[
CloudObject[
  "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][5]
Out[1]=

See its group multiplication table:

In[2]:=
GroupMultiplicationTable[%] // MatrixForm
Out[2]=

See the elements of U10:

In[3]:=
GroupElements@ResourceFunction[
CloudObject[
   "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][10]
Out[3]=

Compute the multiplicative group of various integers:

In[4]:=
ResourceFunction[
CloudObject[
  "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]] /@ Range[10]
Out[4]=

Multiple cyclic factors emerge for composite inputs:

In[5]:=
ResourceFunction[
CloudObject[
  "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][12]
Out[5]=

Calculate large groups:

In[6]:=
AbsoluteTiming@ResourceFunction[
CloudObject[
   "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][50!]
Out[6]=

Calculate its order:

In[7]:=
GroupOrder[%[[2]]]
Out[7]=

Properties and Relations (7) 

Order of MultiplicativeGroup[n] equals EulerPhi[n]:

In[8]:=
GroupOrder[ResourceFunction[
CloudObject[
      "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][#]] == EulerPhi[#] & /@ {3, 4, 12, 15, 101}
Out[8]=

For prime p, MultiplicativeGroup[p] evaluates to CyclicGroup[n-1]:

In[9]:=
ResourceFunction[
CloudObject[
  "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]] /@ {13, 101}
Out[9]=

For odd prime powers, MultiplicativeGroup[pk] evaluates to CyclicGroup[(p-1)pk-1]:

In[10]:=
ResourceFunction[
CloudObject[
  "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][29^10]
Out[10]=
In[11]:=
CyclicGroup[(29 - 1) 29^(10 - 1)]
Out[11]=

For powers of 2, we have:

In[12]:=
Table[{2^k, ResourceFunction[
CloudObject[
     "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][2^k]}, {k, 8}] // TableForm
Out[12]=

MultiplicativeGroup[n] where n has multiple distinct prime factors is never cyclic:

In[13]:=
ResourceFunction[
CloudObject[
  "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][3 5 7]
Out[13]=

MultiplicativeGroup[n] expects n to be a positive integer:

In[14]:=
ResourceFunction[
CloudObject[
  "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][0]
Out[14]=

MultiplicativeGroup[x] returns unevaluated for arbitrary inputs:

In[15]:=
ResourceFunction[
CloudObject[
  "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][x]
Out[15]=
In[16]:=
% /. x -> 4
Out[16]=

Neat Examples (1) 

See the Cayley graph of a large MultiplicativeGroup:

In[17]:=
CayleyGraph[ResourceFunction[
CloudObject[
   "https://www.wolframcloud.com/obj/namantaggar11/DeployedResources/Function/MultiplicativeGroup"]][800]]
Out[17]=