chineseremainder

Calculates the smallest value of n stil satisfing the conditions of n mod p[i] = r[i], i = 0, 1, 2, ..., n-1. Depending on input, function can return scalar, vector or matrix

Arguments

  1. Vector of integers p
  2. Vector of integers r

Output

Integer result n

Examples

chineseremainder