How to compute n(mod c) when n(mod a),n(mod b),a,b,c are given?

50 Views Asked by At

Given a(prime) > b (prime) > c(any number), is there any way to compute n(mod c) ? n%a,n%b,a,b,c are known.

1

There are 1 best solutions below

0
On BEST ANSWER

This is impossible without $c$ being related to $a$ and $b$ in some way; but as you've totally restricted your values of $c$, this is impossible unless $c = 1$, which I'm not sure you're really too interested in!

As an example: take $a = 7, b = 5, c = 3$. Then by the Chinese Remainder Theorem the values of $n$ mod $5$ and $7$ are entirely determined by their values mod $35$. So consider, for example, $2$ mod $5$ and $2$ mod $7$. Then this corresponds to $2$ mod $35$, so the first three solutions are $2$, $37$ and $72$. These are congruent to $2$, $1$ and $0$ mod $3$ respectively. so we've exhibited numbers satisfying

$$2 \equiv 2 \mod{5},\hspace{6pt} 2\equiv 2 \mod {7},\hspace{6pt} 2\equiv 2 \mod{3};$$ $$37 \equiv 2 \mod{5},\hspace{6pt} 37\equiv 2 \mod {7},\hspace{6pt} 37\equiv 1 \mod{3};$$ $$72 \equiv 2 \mod{5},\hspace{6pt} 72\equiv 2 \mod {7},\hspace{6pt} 72\equiv 0 \mod{3},$$

and in particular it's impossible to determine which of the three cases we're in just by looking at data modulo $5$ and $7$.