Arithmetics in finite groups



> To do arithmetics in Z_n, I need a function
> 1. mod that maps to {0,...,n-1}
> 2. that computes inverse elements in(Z_n^*,*)
> 3. that computes a generator for a cyclic group
> Does Maxima offer such functions?

Perhaps this will help:

(C1) describe("modulus");

 0: MODULUS :(maxima.info)Definitions for Polynomials.

Info from file C:/maxima/Maxima590/info/maxima.info:
 - Variable: MODULUS
     default: [FALSE] - if set to a positive prime p, then all
     arithmetic in the rational function routines will be done modulo p.
     That is all integers will be reduced to less than p/2 in absolute
     value (if p=2 then all integers are reduced to 1 or 0).  This is
     the so called "balanced" modulus system, e.g. N MOD 5 = -2, -1, 0,
     1, or 2.  Warning: If EXP is already in CRE form when you reset
     MODULUS, then you may need to re-rat EXP, e.g.
     EXP:RAT(RATDISREP(EXP)), in order to get correct results. (If
     MODULUS is set to a positive non-prime integer, this setting will
     be accepted, but a warning will be given.)
(D1)                               FALSE

(C2) modulus:5;
(D2)                                 5

(C3) makelist(rat(i),i,0,10);

(D3)/R/          [0, 1, 2, - 2, - 1, 0, 1, 2, - 2, - 1, 0]

(C4) makelist(factor(x^i-1),i,1,7);
                                        2
(D4) [x - 1, (x - 1) (x + 1), (x - 1) (x  + x + 1), 

                                             5
     (x - 2) (x - 1) (x + 1) (x + 2), (x - 1) , 

                       2            2
     (x - 1) (x + 1) (x  - x + 1) (x  + x + 1), 

               6    5    4    3    2
     (x - 1) (x  + x  + x  + x  + x  + x + 1)]

(C5) rat((x^3-1)/(x+4));
                                 2
(D5)/R/                         x  + x + 1

(C6) factor(x^3-1,q^2+q+1);

(D6)               (x - 1) (x - q) (x + q + 1)