I have a finite set $S=\{0,1,2,\ldots,n-1\}$ and binary operation $\star$ on $S$ defined by
$$x\star y= \left\{ \begin{array}{l l l} \frac{3(x+y)}{2} ~~\text{modulo} ~~n& \qquad \mbox{if $x$ and $y$ are odd.}\\ x-y ~~\text{modulo} ~~n & \qquad \text{if $x+y$ is odd.}\\ x\cdot y ~~\text{modulo} ~~n & \qquad \text{if $x$ and $y$ are even.}\\ \end{array} \right.$$
I want to write GAP code to get Multiplication Table.
It largely writes itself. First we define $\star$ as a function:
We pick an $n$-value:
Then the multiplication table can be computed using
One warning about
Mthough: GAP indices start at $1$ soM[1][1]returns the value of $0 \star 0$, etc.