How to apply CRT to a congruence system with moduli not coprime?

$x=1 \pmod 8$

$x=5 \pmod{12}$

8 and 12 are not coprime, I could break it to:

$x=1 \pmod 2$

$x=1 \pmod 4$

and

$x=5 \pmod 3$

$x=5 \pmod 4$

But what are the next steps to solve it? By the way, $x$ should be $17$ not sure how to get that number ...

Thanks in advance.


Solution 1:

Alternatively: $$\begin{cases}x\equiv 1\pmod{8}\\ x\equiv 5\pmod{12}\end{cases} \Rightarrow \begin{cases} x=8n+1\\x=12m+5\end{cases} \Rightarrow 8n+1=12m+5 \Rightarrow \\ 2n-3m=1 \Rightarrow \begin{cases}n=2+3k\\m=1+2k\end{cases} \Rightarrow \begin{cases} x=8(2+3k)\\ x=12(1+2k)+5\end{cases} \Rightarrow \\ x=24k+17 \Rightarrow x\equiv 17\pmod{24}.$$