Q:

For which integers $n$ are there solutions to the equation $x^2-y^2=n$

For which integers $n$ are there solutions to the equation $x^2-y^2=n$

I believe $n$ must be divisible by $3$, since for any integers $x,y$ mod $3$. $x^2=3k+1$ and $y^2=3n+1$, thus $x^2-y^2=3(n-r)$.
Then I would have $n=0$ with $x,y=0$.
I also found that $n$ if it is even must be divisible by a power of $2$ greater then $1$. Since if $n$ is even then one of $(x+y),(x-y)$ is even, so both are even. Then $4\mid n$.
I'm not sure if there are more restrictions, or how to determine if there are no more. Assuming these are done correctly.

A:

$(m+1)^2-m^2=2m+1$ gives us all positive odd $n$, eg $1=1^2-0^2,3=2^2-1^2$.
$(m+2)^2-m^2=4(m+1)$ gives us all positive multiples of 4.
$m^2-m^2=0$ and swapping $x,y$ gives us negative odd numbers and negative multiples of 4.
Any square is 0 or 1 mod 4. So we cannot have $x^2-y^2=2\bmod4$.

