These generic functions create 1, 1, 0, and 0 respectively, in any 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 Fp 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 elements a and b of Z/mZ, return a solution x to the linear congruence a.x=b ∈Z/mZ. An error is signalled if no solution exists.
Factorization: [<RngIntElt, RngIntElt>] Default: [ ]
Given an element n∈Z/mZ this function returns true if there exists a∈Z/mZ such that a2=n∈Z/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.
Factorization: [<RngIntElt, RngIntElt>] Default: [ ]
Given an element a of the ring Z/mZ, this function returns an element b of Z/mZ such that b2=a∈Z/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: [<RngIntElt, RngIntElt>] Default: [ ]
Return a sequence containing all square roots of the 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.
> R := ResidueClassRing(2340); Residue class ring of integers modulo 2340 > x := R!1404; > sqrts := AllSquareRoots(x); > sqrts; [ 78, 312, 468, 702, 858, 1092, 1248, 1482, 1638, 1872, 2028, 2262 ] > [ y^2 : y in sqrts ]; [ 1404, 1404, 1404, 1404, 1404, 1404, 1404, 1404, 1404, 1404, 1404, 1404 ]
So 1404 has 12 square roots!