Function aoclib::numbers::chinese_remainder::chinese_remainder
source · pub fn chinese_remainder<N>(constraints: &[Constraint<N>]) -> Option<N>where
N: Integer + Copy + Product + AddAssign + Signed,
Expand description
Find a number n
which follows the supplied constraints.
These constraints are expressed such that for all k
in (0..constraints.len())
:
n % constraints[0].modulus == constraints[0].remainder
n % constraints[1].modulus == constraints[1].remainder
...
n % constraints[k].modulus == constraints[k].remainder
Returns None
if the constraint moduli are not all coprime.