# 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.

Any perfect square , say $$n^2$$, when divided by $$3$$ leaves either $$0$$ or $$1$$ as remainder. ( Check yourself by taking $$n$$ as $$3m$$, $$3m+1$$ or $$3m+2$$ ). Here $$(3k+2)$$ when divided by $$3$$, leaves $$2$$ as remainder. Hence $$(3k+2)$$ cannot be a perfect square for any integer $$k$$.

• Welcome to MSE. What is the point of posting this as an answer to a three year old question with an accepted answer? – José Carlos Santos Dec 31 '19 at 12:02