# Integers $n$ such that $n^2$ is of the form $3k+2$

Find all integer $n$ such that $n^2$ is of the form $$3k+2.$$

In observing I find that it has no integer solution, but I can't solve it mathematically. Any hint regarding this is appreciated. Thanks in advance.

Hint: Write $n$ as $3m+r$ with $m\in\Bbb Z$ and $r\in\{0,1,2\}$

• m(3m+2)+$r^2+r$=$n^2$.how I say it is not of form 3k+2? – Sathasivam K Sep 18 '16 at 16:29
• Please explain it sir? – Sathasivam K Sep 18 '16 at 16:38
• $(3m+r)^2=9m^2+6mr+r^2=3(3m^2+2mr)+r^2$, but none of the possible values of $r$ give $r^2=2$ – John Doe Sep 18 '16 at 20:31

$$n^2 = 3k+2$$

Solving for k:

$$k = \frac{n^2 - 2}{3}$$

For this to be an integer,

$$n^2 - 2 \equiv 0 \mod 3$$ $$n * n \equiv 2 \mod 3$$

The fundamental property of multiplication in modular arithmetic states:

$$(a\ \%\ m) * (b\ \%\ m) \equiv (ab\ \%\ m) \mod m$$

where % is the modulo operator. Therefore:

$$n * n \equiv 2 \equiv (n\ \% \ 3)^2 \mod 3$$

$n\ \%\ 3$ can be either $0$, $1$, or $2$, so $(n\ \%\ 3)^2$ can be either $0$, $1$, or $4$ respectively. None of these are $2$ (mod $3$), so $k$ can never be an integer, regardless of what you choose n to be.