The ring Z/mZ consists of representatives for the residue classes
of integers modulo m > 1. This online help node and the nodes below it describe the operations in Magma for such rings and their elements.
At any stage during a session, Magma will have at most one copy of Z/mZ present, for any m>1. In other words, different names for the same residue class ring will in fact be different references to the same structure. This saves memory and avoids confusion about different but isomorphic structures.
If m is a prime number, the ring Z/mZ forms a field; however, Magma has special functions for dealing with finite fields. The operations described here should not be used for
finite field calculations: the implementation of finite field arithmetic in Magma takes full advantage of the special structure of finite fields and leads to superior performance.
Automatic coercion takes place between Z/mZ and Z so that a binary operation like + applied to an element of Z/mZ and an integer will result in a residue class from Z/mZ.
Using !, elements from a prime field GF(p) can be coerced into Z/pZ, and elements from Z/pZ can be coerced into GF(p^r). Also, transitions between Z/mZ and Z/nZ can be made using ! provided that m divides n or n divides m. In cases where there is a choice -- such as when an element r from Z/mZ is coerced into Z/nZ with m dividing n -- the result will be the residue class containing the representative for r.
> r := ResidueClassRing(3) ! 5; > r; 2 > ResidueClassRing(6) ! r; 2So the representative 2 of 5 mod 3 is mapped to the residue class 2 mod 6, and not to 5 mod 6.
Ring homomorphisms with domain Z/mZ are completely determined by the image of 1. As usual, we require our homomorphisms to map 1 to 1. Therefore, the general homomorphism constructor with domain Z/mZ needs no arguments.
Given a residue class ring R, and a ring S, create a homomorphism from R to S, determined by f(1_R) = 1_S. Note that it is the responsibility of the user that the map defines a homomorphism!
Create the residue class ring Z/mZ.
Create the residue class ring Z/mZ, where m is the integer corresponding to the factorization sequence Q. This is more efficient than creating the ring by m alone, since the factorization Q will be stored so it can be reused later.
Given the ring of integers Z, and an ideal I, create the residue class ring modulo the ideal.
Given the ring of integers Z, and an integer m>1, create the residue class ring Z/mZ.
Create the residue class containing the integer k in residue class ring R.
Create the residue class containing k in the residue class ring R. Here k is allowed to be either an integer, or an element of the finite field F_p in the case R = Z/pZ, or an element of S = Z/nZ for a multiple or divisor n of m (with R = Z/mZ).
Create a `random' residue class in R.
Given R=Z/mZ, create the abelian group of integers modulo m under addition. This returns the finite additive abelian group A (of order m) together with a map from A to the ring Z/mZ, sending A.1 to 1.
Given R=Z/mZ, create the multiplicative group of R as an abelian group. This returns an (additive) abelian group A of order phi(m), together with a map from A to R.
Given R, the ring of integers modulo m or an ideal of it, and an element n of R, create the ideal aZintersect Z of the ring of integers. Note that this creates an ideal, not just a subring.
Create the enumerated set consisting of the elements of the residue class ring R.
Given a residue class ring R=Z/mZ, this function returns the common modulus m for the elements of R.
Given a residue class ring R=Z/mZ, this function returns the factorization of the common modulus m for the elements of R.
Factorization: [ < int, int > ] Default: [ ]
Given an element n inZ/mZ this function returns true if there exists a inZ/mZ such that a^2=n inZ/mZ, false otherwise. If n is a square, a square root a is also returned. If m is large and its prime factorization is known, the computation may be speeded up by assigning the factorization sequence for m to the optional argument Factorization.
Returns true if the element n inZ/mZ is primitive, that is, if it generates the multiplicative group of Z/mZ, false otherwise.
Given R = Z/mZ, this function returns a generator for the group of units of R if this group is cyclic, and returns 0 otherwise. Thus a valid generator is only returned if m = 2, 4, p^t or 2p^t, with p an odd prime and t >= 1.
Given an element a belonging to Z/mZ, return the multiplicative order k >= 1 of a if a is in the unit group (Z/mZ)^*, and zero if a is not a unit.
Factorization: [ < int, int > ] Default: [ ]
Given an element a of the ring Z/mZ, this function returns an element b of Z/mZ such that b^2=a inZ/mZ, if such an element exists, and an error otherwise. If m is large and its prime factorization is known, the computation may be speeded up by assigning the factorization sequence for m to the optional argument Factorization.
Factorization: [ < int, int > ] Default: [ ]
Return a sequence of all square roots of an element a in a residue class ring Z/mZ. If the modulus m is large and its prime factorization is known, the computation may be speeded up by assigning the factorization sequence for m to the optional argument Factorization.
Given elements a and b of Z/mZ, return a solution x to the linear congruence a.x=b in Z/mZ. An error is signalled if no solution exists.
Greatest common divisor of the elements a and b of R, that is, a generator for the R-ideal (a) + (b).
Greatest common divisor of the sequence of elements Q, that is, a generator for the R-ideal generated by the elements in Q.
Least common multiple of the elements a and b of R, that is, a generator for the R-ideal (a) intersect (b).
Least common multiple of the sequence of elements Q, that is, a generator for the R-ideal formed by the intersection of the principal ideals generated by elements of Q.[Next][Prev] [Right] [Left] [Up] [Index] [Root]