code: function chineseRemainder_bignum(a, n){
    var p = bignum(1);
    var p1 = bignum(1);
    var prod = bignum(1);
    var i = 1;
    var sm = bignum(0);
    for(i=0; i< n.length; i++){
      prod = prod.mul( n[i] );
      //prod = prod * n[i];
    }
    for(i=0; i< n.length; i++){
      p = prod.div( n[i] );
  
      //sm = sm + ( a[i] * mul_inv(p, n[i]) * p);
      p1 = mul_inv( p, n[i] );
      p1 = p1.mul( a[i] );
      p1 = p1.mul( p );
      sm = sm.add( p1 );
    }
    return sm.mod(prod);
  }
docs: a, n are array of bignum instances