(50G) Chinese Remainder Theorem: X "congruent to ri" (mod mi),

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (https://www.hpmuseum.org/forum/forum-10.html)
+--- Forum: General Software Library (https://www.hpmuseum.org/forum/forum-13.html)
+--- Thread: (50G) Chinese Remainder Theorem: X "congruent to ri" (mod mi), (/thread-24826.html)



(50G) Chinese Remainder Theorem: X "congruent to ri" (mod mi), - Gil - 2026-03-14 06:36

Two programs for solving several constraints like

X "congruent to r1" (mod m1),
     and 
X "congruent to r2" (mod m2),
     and
X "congruent to r3" (mod m3)
     and... 

with mi, mj not necessarily pairwise prime. 

Use 1 (one step) 
Put on stack level 2 all the remainders ri, 
ie the list {r1, r2, r3, ...). 

Put on stack level 1 all the corresponding divisors mi, 
ie the list {m1, m2, m3, ...}. 

And run the program (just once). 


Use 2 (with successive arrays [ri, mi]) 
[r1 m1]
[r2 m2] and run the program 

last array result 
[r3 m3] and run the program 

Etc. 


Observation
Initially, I did not know about the ICHINREM build-in command of the HP50G calculator, whence here my first long (and redundant) included version.