Re: Number Theory - Chinese Remainder Theorem
- To: mathgroup at smc.vnet.net
- Subject: [mg27966] Re: [mg27954] Number Theory - Chinese Remainder Theorem
- From: BobHanlon at aol.com
- Date: Tue, 27 Mar 2001 01:26:04 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Needs["NumberTheory`NumberTheoryFunctions`"]; ?ChineseRemainder Bob Hanlon In a message dated 2001/3/26 5:51:19 AM, lee.stone at hqasc.army.mil writes: >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. >