For some integer $q$, $q^2 - 5$ is divisible by all of the following EXCEPT which of the following?

$q$ is an integer, so it can either be congruent to $0$, $1$ or $2$ mod $3$. Another way to write $q \equiv 2$ mod $3$ is $q \equiv -1$ mod $3$. This means that $q^2 \equiv 1$ mod $3$ because $(-1)^2=1$. Therefore, $q^2$ has remainder of only $1$ or $0$.

You can extend this to mod $5$, because all integers are congruent to either $0$, $1$, $2$, $3$, $4$ mod$5$, or alternatively $0$, $1$, $2$, $-2$, $-1$. Squaring a number means that the squared number is congruent to either $1$ or $2^2$ or is a multiple of $5$.


When you look at things modulo $3$, there are three kinds of numbers: those of the form $3k$ (multiples of 3), those of the form $3k+1$, and those of the form $3k+2$. Let's try squaring them, and see what form results:

$$\begin{align} (3k)^2 &= 9k^2=3(3k^2)\\ (3k+1)^2 &= 9k^2+6k+1=3(3k^2+2k)+1\\ (3k+2)^2 &= 9k^2+12k+4=3(3k^2+4k+1)+1 \end{align}$$

As you can see, each square is of the form $3K$ or $3K+1$ for some new $K$.

An easier way to check this is to simply look at $0^2$, $1^2$ and $2^2$, since the numbers $0$, $1$ and $2$ serve as representatives for the three classes mentioned above.

As for subtracting $5$, you can do similar calculations.

$$(3k+1)-5=3k-4=3k-6+2=3(k-2)+2$$

or to use a more compact notation:

$$1-5\equiv 2\pmod{3}$$

You can also verify that $0-5\equiv 1\pmod3$.


See any integer which is not a multiple of 3 can be written as $$ q = 3K \pm 1 $$ Therefore, $$ \ q^2 = 9\ k^2 \pm 6K + 1 $$

so, when divided by 3, it always gives remainder as 1.

While for those integers which are multiples of 3, they give remainder as 0.

Hope this Helps !!