Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Number Theory > Diophantine Equations >

ChineseRemainder

ChineseRemainder[{r1, r2, ...}, {m1, m2, ...}]
gives the smallest positive x that satisfies all the integer congruences x mod mi = ri mod mi.
  • If all ri<mi, then the result satisfies x mod mi = ri.
The smallest positive integer x that satisfies x mod 4=3 and x mod 5=4:
Find the smallest positive integer giving remainder 3,5,7 when divided by 2,3,5:
The smallest positive integer x that satisfies x mod 4=3 and x mod 5=4:
In[1]:=
Click for copyable input
Out[1]=
 
Find the smallest positive integer giving remainder 3,5,7 when divided by 2,3,5:
In[1]:=
Click for copyable input
Out[1]=
Database encryption and decryption:
Key generation:
Encrypted data:
Decryption:
Define a residue number system:
Numbers and their representation in a residue system:
Multiplying and recovering in the residue system:
Adding and recovering:
Modular computation of a determinant:
Modular determinants:
Recover result:
Shift residue to be symmetric:
Solve congruential equations using Reduce or FindInstance:
Not all congruential equations have a solution:
A solution exists when Mod[ri, GCD[m1, m2, ...]]EqualMod[rj, GCD[m1, m2, ...]]:
New in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team