Generalized Chinese Remainder Algorithm - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Number Theory : Generalized Chinese Remainder Algorithm

NumberTheory

  

ChineseRemainder

  

generalized Chinese remainder algorithm

 

Calling Sequence

Parameters

Description

Examples

References

Compatibility

Calling Sequence

ChineseRemainder(r, m)

Parameters

r

-

list of residues

m

-

list of positive integer moduli

Description

• 

The "Chinese Remainder Theorem" asserts that, for pairwise relatively prime positive integers m[1], m[2], ..., m[k], and integers r[1], r[2], ..., r[k], the system of simultaneous congruences a = r[1] (mod m[1]), a = r[2] (mod m[2]), ..., a = r[k] (mod m[k]) has a solution a and a is unique modulo the product m[1]m[2] ... m[k] of the m[i].

• 

More generally, this system of simultaneous congruences has a solution if, and only if, each pair of distinct moduli are congruent modulo their greatest common divisor. In this case, the solution is uniquely determined modulo the least common multiple of the moduli.

• 

The ChineseRemainder( r, m ) command computes, if possible, an integer a such that a mod m[ i ] = r[ i ], for all i.

• 

Unlike the chrem command, which requires the moduli to be pairwise coprime, the ChineseRemainder function solves the generalized problem with moduli that need not be pairwise coprime.

• 

In the event that a solution to the simultaneous congruences does not exist, the ChineseRemainder function returns the value FAIL.

Examples

withNumberTheory:

ChineseRemainder11,5,31,17

73

(1)

73mod31,73mod17

11,5

(2)

Note that the moduli need not be coprime.

ChineseRemainder3,7,4,6

7

(3)

The following example originates from the priest Yih-hing, 717 C.E. (See Dickson, p. 58.)

ChineseRemainder1,2,5,5,2,3,6,12

5

(4)

However, for non-coprime moduli, an answer may not exist.

ChineseRemainder2,7,4,6

FAIL

(5)

ChineseRemainder3,7,6,1,4,12,11,6

127

(6)

References

• 

L. E. Dickson, History of the theory of numbers: Volume II, Diophantine Analysis, Dover, 2005 (Reprint of the 1919 edition by the Carnegie Institute.)

Compatibility

• 

The NumberTheory[ChineseRemainder] command was introduced in Maple 2017.

• 

For more information on Maple 2017 changes, see Updates in Maple 2017.

See Also

chrem

igcd

mod

NumberTheory

NumberTheory[AreCoprime]