<s>[INST] $p \mid x^2 +n\cdot y^2$ and $\gcd(x,y)=1 \Longleftrightarrow (-n/p) = 1$ Let $n$ be a nonzero integer, let $p$ be an odd prime not dividing $n$. then $ p \mid x^2 + n\cdot y^2$ and $x,y$ co-prime  $ \Longleftrightarrow(-n/p) = 1 $
How can i prove this? by $(-n/p)$ i mean the Legendre symbol.
For $\implies$ i have already tried this: 
$ p \mid x^2 +n\cdot y^2$, so $x^2 + n\cdot y^2 = 0$ mod $p$. then $x^2 = -n\cdot y^2\mod p$...
So with a little help from my friends this part is done.
Now how to show the other implication?
Greets
Egon
 [/INST] Hint: We have $x^2\equiv -ny^2\pmod{p}$. Multiply both sides by $z^2$, where $z$ is the multiplicative inverse of $y$.
Detail: We need to be careful about the statement of the theorem. So we break up the statement and proof into two parts. When we do, we will discover that the result is stated somewhat too informally.
(i) Suppose that $(-n/p)=1$. Then there exist relatively prime integers $x$ and $y$ such that $p$ divides $x^2+ny^2$.
Proof of (i): Since $(-n/p)=1$, by part of the definition of quadratic residue, $n$ is not divisible by $p$. Also, there exists an integer $x$ such that $x^2\equiv -n\pmod{n}$. Thus $x^2+n$ is divisible by $p$, and therefore $x^2+ny^2$ is divisible by $p$, with $y=1$. Note that $x$ and $y$ are relatively prime.
(ii) Suppose there exist relatively prime integers $x$ and $y$ such that $x^2+ny^2$ is divisible by $p$ and $\gcd(x,y)=1$. This is not enough to show that $(-n/p)=1$. For example, let $n=3$. $x=3$, and $y=1$. Thus we must assume in addition that $n$ is not divisible by $p$. We prove the desired result, with the modification that we add in the condition that $n$ is not divisible by $p$. 
Proof of (ii): Note that $y$ cannot be divisible by $p$. For if it is, then from $p$ divides $x^2+ny^2$ we conclude that $p$ divides $x^2$. Then $p$ divides $x$, contradicting the fact that $x$ and $y$ are relatively prime.
Since $y$ is not divisible by $p$, it has a multiplicative inverse modulo $p$. That is, there is a $z$ such that $zy\equiv 1\pmod{p}$. Then $x^2z^2+ny^2z^2\equiv 0\pmod{p}$. Thus $(xz)^2\equiv -n\pmod{p}$, and the result follows. 
Remark: The theorem should really be stated like this. Let $p$ be an odd prime, and suppose that (the integer) $n$ is not divisible by $p$. Then $(-n/p)=1$ if and only if there exist relatively prime integers $x$ and $y$ such that $x^2+ny^2$ is divisible by $p$. 
</s>