title: How to solve simultaneous congruences equations in r
body: <pre><code>3x ≡ 7(mod2)
  2x ≡ 5(mod3)
  5x ≡ 4(mod7)
  </code></pre>
  
  <p>I solved this congruences in R, like given below</p>
  
  <pre><code>&gt; modlin(3,7,2)
  [1] 1
  &gt; modlin(2,5,3)
  [1] 1
  &gt; modlin(5,4,7)
  [1] 5
  &gt; a&lt;-c(1,1,5)
  &gt; m&lt;-c(2,3,7)
  &gt; chinese(a,m)
  [1] 19
  &gt; prod(2,3,7)
  [1] 42
  </code></pre>
  
  <p>So, I got the correct answer x=19(mod 42)</p>
  
  <p>In this case, GCD(2,3,7)=1, suppose ax≡b(mod p), cx≡d(mod q), gx≡h(mod s) with GCD(p,q,s) is not equal to 1 then i know how to solve this equation using extension of Chinese Remainder Theorem by hand but i don't know in R. Please tell me to solve in R ??</p>