3
$\begingroup$

Suppose we have a large (say, one million) system of congruence inequalities of the form

$n \not\equiv x_i\ (\textrm{mod}\ p_i)$

where $n$ is unknown, $x_i$ are known and $2 \le p_i \le 10007$ are prime numbers. Is there an efficient way to find the $n \in [1, u]$ for some upper limit $u$ that satisfy this system of inequalities?

Edit: I'm looking for a way that would allow me to not look individually at the substantial portion of integers in $[1,u]$ that do not satisfy the equations, and thus be able to use a higher upper limit $u$ than would be possible if I had to loop through all of them.

Note that the system can, as an example, forbid all numbers that are divisible by any of the small primes, so if there is no efficient method to iterate through numbers not divisible by 2, 3, 5, 7, 11, ..., 10007, that would imply there is no efficient solution to this problem either. However, these constraints go further; they may forbid up to $p-1$ of the modulo classes of each prime $p$.

  • 0
    What do you mean by $u$ is consistent with the system?2017-01-13
  • 1
    Use the CNRT (Chinese Non-Remainder Theorem), Just kidding (is kidding allowed on MSE?).2017-01-14
  • 0
    A sieve should do this fast enough for practical purposes, unless the number of in-equations and primes are way more than what you indicate.2017-01-14
  • 0
    I expect the numbers that satisfy the inequalities to be rare; for many small primes, around half of the remainder classes are constrained out (so for each of those primes half of the search space is cut), and I'm looking to have a large $u$. So, I'd specifically like to avoid searching the entire $[1, u]$ space. Indeed search space pruning is the reason I have these inequalities in the first place.2017-01-14

0 Answers 0