I found this exercise in a book, but I don't even know how to start tackling it.
Find the lesser positive integer z such that:
$1234 \equiv z \mod 5$
$2^{240} \equiv z \mod 3$
Looking at their definitions, I can say that $1234 \equiv z \mod 5$ $\implies$ $5 | 1234-z$, which implies that $1234-z=5c$ for some integer $c$. Likewise, $2^{240} \equiv z \mod 3$ $\implies$ $3|2^{240}-z$, which implies that $2^{240}-z=3d~$ for some integer $d$.
I don't know where to go from here. I deduced $1234-5c=2^{240}-3d$, but I'm not sure how does that help me. I'm also unsure about the "lesser" condition.
Any hint will be really appreciated. Thanks in advance.
$1234 \equiv z \mod 5$, so $z\equiv 4\bmod 5$
$2^{240} \equiv z \mod 3$, and $2^2 = 4\equiv 1 \bmod 3$, so $z\equiv (2^2)^{120} \equiv 1^{120} \equiv 1 \bmod 3$
So: given
$\begin{align} z \equiv 4\bmod 5\\ z \equiv 1 \bmod 3\\ \end{align}$
and we can certainly find a solution$\bmod 15$ through the Chinese remainder theorem. For these small numbers we can just use examination:
$z \equiv 4\bmod 5 \implies z\in\{4,9,14\} \bmod 15$
$z \equiv 1\bmod 3 \implies z\in\{1,4,7,10,13\} \bmod 15$
and we have $z\equiv 4 \bmod 15$ and $z=4$ as the smallest positive solution.