# Solving two simultaneous modular equations for a maximum case solution

Consider two sets of numbers.

$$E_1=\{1,1,-1,...\}$$

$$E_2=\{1,-1,-1,...\}$$

Let the number of elements in $$E_1$$ be $$n_1$$ and the number of elements in $$E_2$$ be $$n_2$$. The number of 1's and -1's in each set may vary for different cases. The maximum of total number of elements for both sets, i.e. $$n_1 + n_2$$ that could be present is $$N$$.

$$max(n_1+n_2)=N$$

Let $$E_1(i)$$ denote the $$i^{th}$$ element of $$E_1$$, $$i=1, ..., n_1$$, $$E_2(j)$$ denote the $$j^{th}$$ element of $$E_2$$, $$j=1, ..., n_1$$, $$\sum_{i=1}^{n_1} E_1(i) = a$$ and $$\sum_{j=1}^{n_2} E_2(j) = b$$.

$$a$$ and $$b$$ should satisfy the relationships,

$$a \equiv 0 (mod p)$$

$$b \equiv 0 (mod q)$$, where $$p,q$$ are two distinct primes. These two relationships are satisfied when $$n_1+n_2 as well as when $$n_1+n_2 =N$$.

Suppose I do not know,

1. the elements of the two sets $$E_1$$ and $$E_2$$
2. $$n_1$$ and $$n_2$$

But I know $$p, q$$ and $$N$$ (Actually $$N=pq$$). Then, is there a method to determine the values of $$a$$ and $$b$$ using the above two equations for the case $$n_1+n_2=N$$ (i.e. the maximum case)?

It is not clear to me, this is not like considering two normal simultaneous equations but here congruence relations are present.