Prove that for each $n \in Z$ the $3n^2-1$ is not the square of an integer We assume that $3n^2-1 = p^2$ where $p \in Z$. I followed two approaches but I can not solve the problem. 
First Approach:
$3n^2-1 = p^2 \rightarrow 3n^2 = p^2 + 1 \rightarrow 3n^2 = p*p + 1$
So, 
$3n^2 \equiv 1 (mod p) $ 
Second Approach:
$3n^2-1= p^2 \rightarrow  3n^2 - p^2 = 1 \rightarrow (n*\sqrt{3} + p)(n*\sqrt{3} - p) = 1$ 
Can you give me a hint about how can I solve it ?
 A: Hint: $3$ never divides $p^2+1$ for every positive integer $p$. 
To prove this, you can consider the cases $p=3k, 3k+1, 3k+2$ for $k \in \mathbb{Z}$.
A: The $n^2$ in the question would appear to be a red herring as it's quite simple to prove the stronger statement "For each $n \in \mathbb{N}, \;3n-1\;$ is not the square of an integer.
To see this, simply take any integer $k$, and consider the possible residues (mod 3); in each case it should be easy to show that $k^2 \not \equiv -1 \pmod 3$.
A: Hint : Use modular arithmetic to show that $$3n^2 \equiv 0 \mod3$$ and similarly $$3n^2 -1 \equiv 2 \mod3.$$
Can you show that no square is $\equiv 2\mod3 ?$
A: A result similar to that obtained with reference to $\bmod 3$ in the previous answers can also be obtained by analysis $\bmod 4$.
The square of any odd number $\equiv 1 \bmod 4$
The square of any even number $\equiv 0 \bmod 4$
Substituting, $3n^2-1\equiv (2\ \text{or}\ -1) \bmod 4$, and no square $\equiv (2\ \text{or}\ -1) \bmod 4$ (see previous two statements).
Hence $3n^2-1$ cannot be a square. 
