<s>[INST] How do I solve the system of congruences $x \equiv 1 \pmod{3}$, $x \equiv 2 \pmod{4}$, $x \equiv 4 \pmod{5}$, $x \equiv 2 \pmod{7}$? Sorry for the weird title, but I don't know how else to phrase this.
Say I have a set of numbers, and the remainders each get by dividing them by a certain number. For instance:

$x \equiv 1 \pmod{3}$
$x \equiv 2 \pmod{4}$
$x \equiv 4 \pmod{5}$
$x \equiv 2 \pmod{7}$

I know the math is similar to finding the least common multiple, but I can't grok it. How do I find $x$ in the above equations, assuming they all use the same $x$?
Additionally, after that's found, how do I find further multiples that fit these restrictions?
 [/INST] Since $x\equiv2\pmod{4}$ and $x\equiv2\pmod{7}$, we must have that $x\equiv2\pmod{28}$.
We can use the Extended Euclidean Algorithm as implemented in this answer to solve the following equivalences.
Since $140=5\cdot28$, solve
$$
\begin{align}
x&\equiv1\pmod{3}\\
x&\equiv0\pmod{140}
\end{align}
$$
getting $x\equiv280\pmod{420}$.
Since $84=3\cdot28$, solve
$$
\begin{align}
x&\equiv1\pmod{5}\\
x&\equiv0\pmod{84}
\end{align}
$$
getting $x\equiv336\pmod{420}$.
Since $15=3\cdot5$, solve
$$
\begin{align}
x&\equiv1\pmod{28}\\
x&\equiv0\pmod{15}
\end{align}
$$
getting $x\equiv225\pmod{420}$.
We can get the solution to the original equivalence as
$$
x\equiv\overbrace{1\cdot280}^{\substack{1\pmod{3}\\0\pmod{4}\\0\pmod{5}\\0\pmod{7}}}+\overbrace{4\cdot336}^{\substack{0\pmod{3}\\0\pmod{4}\\4\pmod{5}\\0\pmod{7}}}+\overbrace{2\cdot225}^{\substack{0\pmod{3}\\2\pmod{4}\\0\pmod{5}\\2\pmod{7}}}\equiv\overbrace{\ 394\ }^{\substack{1\pmod{3}\\2\pmod{4}\\4\pmod{5}\\2\pmod{7}}}\pmod{420}
$$
</s>