Number Theory - Chinese Remainder Theorem
- To: mathgroup at smc.vnet.net
- Subject: [mg27954] Number Theory - Chinese Remainder Theorem
- From: lee.stone at hqasc.army.mil
- Date: Mon, 26 Mar 2001 05:27:03 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
I am studying the Chinese Remainder Theorem. I am using have been using the
following code to solve CRT problems.
PairwiseQ[m-List] := Apply[LCM, m] == Apply[Times, m]
CRT[a_, m_] := Module[{M = Apply[Times, m]},
If[PairwiseQ[m], Mod[Apply[Plus, a * PowerMid[M/m, -1, m] * M/m], M],
{}]]
I would like modify this code to also be able to solve moduli that are not
relatively prime and to return the empy set ({}) if the congurences have no
solution.
Lee Stone