chrem
Chinese Remainder Algorithm
Calling Sequence
Parameters
Description
Examples
chrem(u, m)
u
-
list [u1,..., un] of evaluations
m
list of moduli [m1,..., mn]
The list of moduli m must be pairwise relatively prime positive integers. (For the case of non-coprime moduli, see NumberTheory[ChineseRemainder].) Both lists u and m must be the same length n. The list of images u need not be reduced modulo m on input. In the following, M denotes the product of the moduli.
If u is a list of integers, chrem(u, m) computes the unique positive integer a such that a⁢mod⁢m1=u1,a⁢mod⁢m2=u2,⁢...⁢,a⁢mod⁢mn=un , and 0≤⁢a<M.
If the global variable mod has been assigned to mods then the result a is returned in the symmetric range for the integers modulo M. For example, the symmetric range for the integers modulo M=35 is -17≤⁢a≤+17.
If u is a list of polynomials, chrem is applied across the polynomials so that the output f is a polynomial satisfying fmodm1=u1 , ..., fmodmn=un.
If u is a list of lists, chrem is applied across the lists so that the output will be a list L satisfying Lmodm1=u1, ..., Lmodmn=un .
For a definition, see Chinese remainder theorem.
chrem⁡1,2,5,7
16
chrem⁡3⁢x+1,x+2⁢y+2,5,7
8⁢x+16+30⁢y
chrem⁡3,0,1,1,2,2,5,7
8,30,16
`mod`≔mods
mod≔mods
8⁢x+16−5⁢y
See Also
GaussInt
GIchrem
NumberTheory[ChineseRemainder]
Download Help Document