Suppose $n\in\mathbb{Z}$. If $3 \nmid n^2$, then $3 \nmid n$. Suppose $n\in\mathbb{Z}$. If $3 \nmid n^2$, then $3 \nmid n$.


Assume $3|n$, that is $n=3m$ for some $m\in\mathbb{Z}$, so $n^2=(3m)^2=9m^2=3(3m^2)$. Let $3m^2=x$, then we have  $n^2=(3m)^2=9m^2=3(3m^2)=3x$, it means that $3|n^2$, so we are done.

Can you check my proof? Thankss...
Also, for any prime $p$
and positive integer $a$,
if
$p^a | n$
then
$n = p^am$
so
$n^2 
= p^{2a}m^2
= p^a(p^{a}m^2)
$
so
$p^{a} | n^2$.

Therefore,
if 
$p^{a} \not\mid n^2$
then
$p^{a} \not\mid n$.

Also see this question of mine
for a further generalization:

If $n \mid a^2 $, what is the largest $m$ for which $m \mid a$?
Also, for any prime $p$
and positive integer $a$,
if
$p^a | n$
then
$n = p^am$
so
$n^2 
= p^{2a}m^2
= p^a(p^{a}m^2)
$
so
$p^{a} | n^2$.

Therefore,
if 
$p^{a} \not\mid n^2$
then
$p^{a} \not\mid n$.

Also see this question of mine
for a further generalization:

If $n \mid a^2 $, what is the largest $m$ for which $m \mid a$?