<s>[INST] How to find all integer solutions of an equation which are divisible by 8? I have to find out all integer solutions of $n^2+15$ which are divisible by 8. So my idea was to solve the following equation.
$$n^2+15=8\cdot k \to n^2=8\cdot k-15 \to  n=\sqrt{8\cdot k-15}$$
But this doesn't work.I tried some numbers $n=1, n=3, n=5, n=7$ for these numbers I get integer solutions of $n^2+15$ which are divisible by 8. It seems to be that $n$ must be odd. How do I solve this correctly?
Best regards
 [/INST] $n^2 + 15 = 8k \implies$
$n^2 -1 = 8(k-2) \implies$
$(n + 1)(n-1) = 8(k-2)$
If $n$ is even then $n+1$ and $n-1$ are odd and this is impossible.
If $n$ is odd then $n+1$ and $n-1$ are even.  If one of them is not divisible by $4$ than the other one is.  So if $n$ is odd hen $(n+1)(n-1)=n^2 -1$ is divisible by $8$ and $n^2 +15$ is divisible by $8$.
..or ..
Postactively:  If $n = 2k+1$ than $n^2 + 15 = (2k+1)^2 + 4k^2 + 4k + 16 = 4(k^2 + k + 2)= 8(\frac {k(k+1) }2 + 1)$
... or ...
Let $n = 4k + i; i = 0, \pm 1, \pm 2$
Then $n^2 + 15 = 16k + 8ki + i^2 + 15$ so $n^2 + 15$ is divisible by $8$ iff $15+i^2$ is.  $15+ 0^2$ and 15+ (\pm 2)^2$ are not.  $15 + (\pm 1)^2 = 16$ is.
So $n^2 + 15$ is divisible by $8$ iff $n \equiv \pm 1 \mod 4$ iff $n$ is odd.
</s>