<s>[INST] How to solve $(x \mod 7) - (x \mod 8) = 5$? I'm trying to solve $(x \mod 7) - (x \mod 8) = 5$ but no idea where to start. Help appreciated!
 [/INST] I'm going to assume you are incorrectly assuming $\mod n$ refers to the remainder function and want to solve $(x \% 7) -(x\% 8) = 5$ where $a \% b$ is the unique remainder when $a$ is divided by $b$.
$x \% 7 = a$ means $x = 7k + a$ for some integer $k$ and integer $0 \le a < 7$.  So $a = x - 7k$.
And $x \%  8 = b$ means $x = 8j + b$ for some integer $j$ and integer $0 \le b < 8$. So $b = x - 8j$
So $a - b = 8j - 7k = 5$.  By Bezout Lemma solutions exist.  Let's find them.
$8*1 - 7*1 = 1$ so $8*5 - 7*5 =5$ is such a solution and $x = 5*7 + a = 35+a$ and $x = 5*8 + b = 40+b$ which can work with $a = 5$ or $6$ and $b = 0$ or $1$.
So $x = 40$ or $41$ will be solutions.
</s>