On the Subject of Chinese Remainder Theorem
More like... Chinese Remainder TFCeorem!
-
For each of the module’s 4-8
N % A = Bequations (which there will be 4 to 8 of; press the green button while the top display is blank to cycle through them):-
Break
Adown into its prime factorsp1q1,p2q2... -
For every prime factor with its power
pq:-
If you have already noted down an equation of form
N %, wherepr= ...ris greater thanq, skip this prime factor. -
Otherwise, note down the equation
N %.pq= (B %pq)-
If you previously had a noted equation of form
N %, wherepo= ...ois less thanq, remove it from your notes.
-
If you previously had a noted equation of form
-
If you have already noted down an equation of form
-
Break
-
Introduce letter variables
a,b,c... one for each of your noted equations excluding one (e.g. you should introduce variablesa,b,c,d, andeif you have 6 noted equations), all initially equal to 0. -
Introduce a variable
N, equal toB + A*a, whereAandBare taken from any of the noted equations. Remove the said equation from your notes. - Start with the
avariable being your current letter variable. -
If there is a noted equation that is met by the current value of
N:- If this is the last remaining noted equation, remove it from your notes, then input and submit
N’s value into the module to solve it. -
Otherwise, set the current letter variable to be equal to
v + A*n, where:vis the value of the variable at this point.Ais taken from the aforementioned equation.nis the letter variable that follows the current letter variable.
- Remove the said equation from your notes.
- Move on to the next letter variable (
n) being your current letter variable, and check Step 5’s condition again.
- If this is the last remaining noted equation, remove it from your notes, then input and submit
- Otherwise, increment the value of the current letter variable, then check Step 5 again.