# Revision history [back]

In your example you rely on multiplication of integers modulo 10, so any group using this operation will be the unit group of $\mathbb{Z}/10\mathbb{Z}$. However, number 2 and 4 cannot be there as they are not invertible modulo 10. So, perhaps you mean semigroup (monoid) rather than a group.

Monoid for your example can be constructed as follows:

mygens = [1,2,3,4]
R = IntegerModRing(10)
G = R.submonoid( Family({n:R(e) for n,e in enumerate(mygens)}) )


Then multiplication table can be constructed with OperationTable:

from sage.matrix.operation_table import OperationTable
print( OperationTable(G, operation=operator.mul, names='elements') )


which gives:

*  1 2 3 4 6 8 9 7
+----------------
1| 1 2 3 4 6 8 9 7
2| 2 4 6 8 2 6 8 4
3| 3 6 9 2 8 4 7 1
4| 4 8 2 6 4 2 6 8
6| 6 2 8 4 6 8 4 2
8| 8 6 4 2 8 4 2 6
9| 9 8 7 6 4 2 1 3
7| 7 4 1 8 2 6 3 9


In your example you rely on multiplication of integers modulo 10, so any group using this operation will be a subgroup of the unit group of $\mathbb{Z}/10\mathbb{Z}$. However, number numbers 2 and 4 cannot be there as they are not invertible modulo 10. So, perhaps you mean semigroup (monoid) rather than a group.

Monoid for your example can be constructed as follows:

mygens = [1,2,3,4]
R = IntegerModRing(10)
G = R.submonoid( Family({n:R(e) for n,e in enumerate(mygens)}) )


Then multiplication table can be constructed with OperationTable:

from sage.matrix.operation_table import OperationTable
print( OperationTable(G, operation=operator.mul, names='elements') )


which gives:

*  1 2 3 4 6 8 9 7
+----------------
1| 1 2 3 4 6 8 9 7
2| 2 4 6 8 2 6 8 4
3| 3 6 9 2 8 4 7 1
4| 4 8 2 6 4 2 6 8
6| 6 2 8 4 6 8 4 2
8| 8 6 4 2 8 4 2 6
9| 9 8 7 6 4 2 1 3
7| 7 4 1 8 2 6 3 9


In your example you rely on multiplication of integers modulo 10, so any group using this operation will be a subgroup of the unit group of $\mathbb{Z}/10\mathbb{Z}$. However, numbers 2 and 4 cannot be there as they are not invertible modulo 10. So, perhaps you mean semigroup (monoid) rather than a group.

Monoid Semigroup for your example can be constructed as follows:

mygens = [1,2,3,4]
R = IntegerModRing(10)
G = R.submonoid( Family({n:R(e) R.subsemigroup( (R(g) for n,e g in enumerate(mygens)}) mygens), one=R(1) )


Then multiplication table can be constructed with OperationTable:

from sage.matrix.operation_table import OperationTable
print( OperationTable(G, operation=operator.mul, names='elements') )


which gives:

*  1 2 3 4 6 8 9 7
+----------------
1| 1 2 3 4 6 8 9 7
2| 2 4 6 8 2 6 8 4
3| 3 6 9 2 8 4 7 1
4| 4 8 2 6 4 2 6 8
6| 6 2 8 4 6 8 4 2
8| 8 6 4 2 8 4 2 6
9| 9 8 7 6 4 2 1 3
7| 7 4 1 8 2 6 3 9


In your example you rely on multiplication of integers modulo 10, so any group using this operation will be a subgroup of the unit group of $\mathbb{Z}/10\mathbb{Z}$. However, numbers 2 and 4 cannot be there as they are not invertible modulo 10. So, perhaps you mean semigroup (monoid) rather than a group.

Semigroup $G$ for your example can be constructed as follows:

mygens = [1,2,3,4]
R = IntegerModRing(10)
G = R.subsemigroup( (R(g) for g in mygens), one=R(1) )


Then multiplication table can be constructed with OperationTable:

from sage.matrix.operation_table import OperationTable
print( OperationTable(G, operation=operator.mul, names='elements') )


which gives:

*  1 2 3 4 6 8 9 7
+----------------
1| 1 2 3 4 6 8 9 7
2| 2 4 6 8 2 6 8 4
3| 3 6 9 2 8 4 7 1
4| 4 8 2 6 4 2 6 8
6| 6 2 8 4 6 8 4 2
8| 8 6 4 2 8 4 2 6
9| 9 8 7 6 4 2 1 3
7| 7 4 1 8 2 6 3 9


ADDED. When $G$ represent a group, we can explicitly create its isomorphic permutation group (subgroup of $\mathrm{Sym}(G)$). For example:

mygens = [1,3]
R = IntegerModRing(10)
G = R.subsemigroup( (R(g) for g in mygens), one=R(1) )

P = PermutationGroup([[G(g)*b for b in G] for g in mygens], domain=G)
print("elements of P:",list(P))
M = {g:P([G(g)*b for b in G]) for g in G}  # map from G to P
print("map G->P:",M)


prints

elements of P: [(), (1,9)(3,7), (1,7,9,3), (1,3,9,7)]
map G->P: {1: (), 3: (1,3,9,7), 9: (1,9)(3,7), 7: (1,7,9,3)}


In your example you rely on multiplication of integers modulo 10, so any group using this operation will be a subgroup of the unit group of $\mathbb{Z}/10\mathbb{Z}$. However, numbers 2 and 4 cannot be there as they are not invertible modulo 10. So, perhaps you mean semigroup (monoid) rather than a group.

Semigroup $G$ for your example can be constructed as follows:

mygens = [1,2,3,4]
R = IntegerModRing(10)
G = R.subsemigroup( (R(g) for g in mygens), one=R(1) )


Then multiplication table can be constructed with OperationTable:

from sage.matrix.operation_table import OperationTable
print( OperationTable(G, operation=operator.mul, names='elements') )


which gives:

*  1 2 3 4 6 8 9 7
+----------------
1| 1 2 3 4 6 8 9 7
2| 2 4 6 8 2 6 8 4
3| 3 6 9 2 8 4 7 1
4| 4 8 2 6 4 2 6 8
6| 6 2 8 4 6 8 4 2
8| 8 6 4 2 8 4 2 6
9| 9 8 7 6 4 2 1 3
7| 7 4 1 8 2 6 3 9


ADDED. When $G$ represent represents a group, we can explicitly create its isomorphic permutation group $P$ (subgroup of $\mathrm{Sym}(G)$). For $\mathrm{Sym}(G)$) as in the following example:

mygens = [1,3]
R = IntegerModRing(10)
G = R.subsemigroup( (R(g) for g in mygens), one=R(1) )

P = PermutationGroup([[G(g)*b for b in G] for g in mygens], domain=G)
print("elements of P:",list(P))
M = {g:P([G(g)*b for b in G]) for g in G}  # map from G to P
print("map G->P:",M)


printswhich prints:

elements of P: [(), (1,9)(3,7), (1,7,9,3), (1,3,9,7)]
map G->P: {1: (), 3: (1,3,9,7), 9: (1,9)(3,7), 7: (1,7,9,3)}