Module aoclib::numbers::chinese_remainder
source · Expand description
The Chinese Remainder Theorem is used to efficiently calculate a number n
which
has several constraints of its modulus. Each constraint specifies the modulus and the
remainder, such that:
n % constraints[0].modulus == constraints[0].remainder
n % constraints[1].modulus == constraints[1].remainder
...
n % constraints[k].modulus == constraints[k].remainder
This module is adapted from the example in Rosetta Code
Structs
- A constraint for the calculation of the Chinese Remainder Theorem
Functions
- Find a number
n
which follows the supplied constraints.