4.10.1.1 IntegerModRing Objects

class IntegerModRing
The ring of integers modulo N, e.g., when N is prime this is a prime finite field.
IntegerModRing( modulus)

Create with the command IntegerModRing(modulus)

INPUT:
    modulus -- an integer > 1

OUTPUT:
    IntegerModRing -- the ring of integers modulo N.

First we compute with integers modulo $ 17$ .

sage: FF = IntegerModRing(17)
sage: FF
Ring of integers modulo 17
sage: FF.is_field()
True
sage: FF.characteristic()
17
sage: FF.modulus()
17
sage: gens = FF.unit_gens()
sage: a = gens[0]
sage: a
3
sage: a.is_square()
False
sage: def pow(i): return a**i
sage: [pow(i) for i in range(16)]
[1, 3, 9, 10, 13, 5, 15, 11, 16, 14, 8, 7, 4, 12, 2, 6]

Next we compute with the integers modulo $ 16$ .

sage: Z16 = IntegerModRing(16)
sage: Z16.is_field()
False
sage: Z16.modulus()
16
sage: Z16.characteristic() 
16
sage: gens = Z16.unit_gens()
sage: gens
[15, 5]
sage: a = gens[0]
sage: b = gens[1]
sage: def powa(i): return a**i
sage: def powb(i): return b**i
sage: gp_exp = FF.unit_group_exponent()
sage: gp_exp
16
sage: [powa(i) for i in range(15)]
[1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1]
sage: [powb(i) for i in range(15)]
[1, 5, 9, 13, 1, 5, 9, 13, 1, 5, 9, 13, 1, 5, 9]
sage: a.order()
2
sage: b.order()
4

Instances of class IntegerModRing have the following functions (in addition to inherited functions and special functions):

characteristic,$  $ factored_modulus,$  $ is_field,$  $ modulus,$  $ name,$  $ random,$  $ unit_gens,$  $ unit_group_exponent

Further documentation:

unit_gens( )

Returns generators for the $ (\mathbf{Z}/N\mathbf{Z})^*$ .

We compute the list of generators using a deterministic algorithm, so the generators list will always be the same. Each generator corresponds to a prime divisor of $ N$ (or possibly two prime divisors for p=2).

INPUT: (none)
OUTPUT:
    list -- a list of elements of self

Instances of class IntegerModRing also have the following special functions:

__call__,$  $ __cmp__,$  $ __getitem__

See About this document... for information on suggesting changes.