If $n$ is even, which values could $n \% 4$ be equal to?

189 Views Asked by At

I am attempting to find a way to solve this problem. I understand that if $n$ is even, then $n = 2k$, however, I am struggling to understand how to solve this question.

I assume that since you are being asked $n \% 4$, that $2k$ will need to be divided by $4$ at some stage.

Could somebody explain to me the steps I would need to take to solve problems like this?

2

There are 2 best solutions below

1
On

Hint:

The values of $n\bmod4$ are in $[0,3]$ periodically, and it suffices to try with $n=0$ and $n=2$.

0
On

It is easier to start from the other end.

$n \mod 4$ can be $0,1,2$ or $3$.

If $n \mod 4 = 0$ then $n=4k$ for some integer $k$. Is $n$ even or odd ?

If $n \mod 4 = 1$ then $n=4k+1$ for some integer $k$. Is $n$ even or odd ?

If $n \mod 4 = 2$ then $n=4k+2$ for some integer $k$. Is $n$ even or odd ?

If $n \mod 4 = 3$ then $n=4k+3$ for some integer $k$. Is $n$ even or odd ?