Implication from mod-constraints on a number In a recent exercise I had to program a function that finds the smallest number $x$ such that 
$$x \equiv 3 \mod 5$$
$$x \equiv 4 \mod 6$$
$$x \equiv 4 \mod 9$$
$$x \equiv 6 \mod 8$$
$$x \equiv 0 \mod 7$$
The programming was easy and the number smallest number $x$ under the above constraints turned out to be 238. However, I also noticed that I find the same number when I leave out the last constraint $x \equiv 0 \mod 7$. Now my question is: do the first four constraints already imply the last one or is it just a coincidence that the same number is returned in this case? I tried to play around with the first four constraints but I could not derive anything meaningful for the last one so far. 
 A: No, definitely not. By the Chinese Remainder Theorem, the first four equations can only specify the solutions up to modulo 360, because 360 is the least common multiple of 5, 6, 8 and 9. This means 360 + 238 = 598 is also a solution, but 598 is not divisible by 7. So 238 being divisible by 7 is just a 'coincidence'.
A: Since $7$ is coprime to the other bases, that constraint is entirely additional to the other constraints, and the fact that you get the smallest number from the other constraints fitting that constraint is indeed a coincidence.
The three middle constraint bases carry the potential for eliminating any possible solutions, as $6$ is not coprime to either $8$ or $9$. However, fortunately for finding a solution, they are consistent in that, considered to their greatest common divisors, the relevant pairs give the same constraint:
$$\begin{align}
\left . \begin{array}{l} x\equiv 4 \bmod 6\\[1ex] x \equiv 4 \bmod 9 \end{array} \right\} & \implies x\equiv 4\equiv 1 \bmod 3\\[2ex]
\left . \begin{array}{l} x\equiv 4 \bmod 6\\[1ex] x \equiv 6 \bmod 8 \end{array} \right\} & \implies x\equiv 2\equiv 0 \bmod 2\\
\end{align}$$
Reassured of their consistency, the first pairing immediately gives the constraint to their least common multiple:
$$\left . \begin{array}{l} x\equiv 4 \bmod 6\\[1ex] x \equiv 4 \bmod 9 \end{array} \right\}  \implies x\equiv 4\bmod 18$$
and a short search turns up the appropriate value to incorporate the $\bmod 8$ constraint also:
$$\left . \begin{array}{l} x\equiv 4 \bmod 18\\[1ex] x \equiv 6 \bmod 8 \end{array} \right\}  \implies x\equiv 22 \bmod 72
$$
then adding in the $\bmod 5$ constraint we find
$$\left . \begin{array}{l} x\equiv 3 \bmod 5\\[1ex] x \equiv 22 \bmod 72 \end{array} \right\}  \implies x\equiv 238 \bmod 360
$$
And finally the $\bmod 7$ constraint gives
$$\left . \begin{array}{l} x\equiv 0 \bmod 7\\[1ex] x \equiv 238 \bmod 360 \end{array} \right\}  \implies x\equiv 238 \bmod 2520
$$
Thus the (positive) numbers satisfying the first four constraints begin with $238, 598, 958, ...$ but those satisfying all constraints start $238, 2758, 5278, ...$
