As the title says, my problem is this:
Find a number $x \in \mathbb{Z}/{355213}\mathbb{Z}$ such that $x = 2 \mod 71$ and $x = 13 \mod 5003$.
I know that $71\cdot 5003 = 355213$. I also know that $71$ and $5003$ are prime.
I solved this with programming ($x=235154$), but I naively searched through all possibilities. I'd like to know how to solve this without programming.
The first equation shows that $x = 2 + 71n$ for some $n \in \mathbb{Z}$.
The second equation is that $x = 13 + 5003m$ for some $m \in \mathbb{Z}$.
So we must find integers n and m such that $2 + 71n = 13 + 5003m$, or $71n - 5003m = 11$.
The Extended Euclidean Algorithm can be used to find them.
Start by dividing $-5003$ by $71$: $$-5003 = (-71)*71+38$$ Then continue by dividing each quotient by remainder: \begin{align} 71 &= 1*38+33 \\ 38&=1*33+5 \\ 33&=6*5+3 \\ 5&=1*3+2 \\ 3&=1*2+1 \\ \end{align}
Now go back up the chain to write $gcd(-5003,71)=1$ in terms of $-5003$ and $71$: \begin{align} 1&=3-1*2 \\ &=3-1*(5-1*3) \\ &=2*3-5 \\ &=2*(33-6*5)-5 \\ &=2*33-13*5 \\ &=2*33 - 13*(38-33) \\ &=15*33-13*38 \\ &=15*(71-38)-13*38 \\ &=15*71-28*38 \\ &=15*71-28*(-5003+71*71) \\ &=-1973*71-28*(-5003)\\ \end{align}
Multiply both sides of the equation $1 = -1973*71 - 28*(-5003)$ by $11$ to get $11 = -21703*71-308*(-5003)$. So $n=-21703$ is one solution, which gives $x = 2 + 71(-21703) = -1 540 911$ in $\mathbb Z_{355213}$ which is equivalent to your solution of $235154$.