I want to know which primes $p$ can be written in the form $p=x^2ny^2$ for given $n \in \mathbb{N}$. If $n$ is squarefree, $n \not\equiv 1 \mod 4$ and $\mathbb{Z}[\sqrt{n}]$ is a principal ideal domain, this has been answered here. Is anything known about the other cases?

6$\begingroup$ In general it's a complicated question in class field theory. If Q(sqrt(n)) has nontrivial class group then you have the global complicated problem that a prime p splits into two principal primes in the integers of Q(sqrt(n)) iff it splits completely in the Hilbert class field, which is in general a nonabelian extension of Q so there will be no "formula" for this, there will just be density or growth results. And then on top of that you have the issue about Z[sqrt(n)] v full ring of integers of Q(sqrt(n)) and also the sign of a fundamental unit. So, lots and lots known but hard to summarise. $\endgroup$– wrigleyNov 1, 2016 at 14:44
2 Answers
Check out the book by Cox: Primes of the form $x^2+ny^2$. In this book, Theorem 9.2 gives a reasonable description of primes of the form $p=x^2+ny^2$. I believe the same result (and proof) works verbatim when $n$ is replaced by $n$ in this theorem. The only difference is that if a prime can be written as $x^2ny^2$, then it can be written in this form in infinitely many ways. This also means, by Chebotarev's density theorem, that the relative density of these primes is a positive rational number depending on $n$ (which can be determined effectively).
I also recommend reading Weinstein's excellent recent survey on related (and more general) questions.
P.S. I just realize the question was asked more than a year ago. Still, my answer might be of use for some.

4$\begingroup$ Theorem 9.2 holds in the indefinite case with the stipulation that we have to take the narrow ring class field. If we take the wide ring class field then it only tells us for which primes $p$ either $p$ or $p$ is represented by the given form. On the side of forms the narrow class group of the given order corresponds to the proper equivalence of forms while the wide class group corresponds to the signed equivalence. This is explained at the end of section 7.B. $\endgroup$ Feb 6, 2018 at 16:17

$\begingroup$ @JarekKuben: Thanks for your valuable comment! $\endgroup$ Feb 6, 2018 at 17:13
There are many primes that can be represented as $p=x^2ny^2$. Probably infinitely many.
In the following example we keep the multiplier n constant and we vary $y^2$ while skipping the values of $y^2$ that do not produce a prime.
$$13^22*1^2=167$$ $$13^22*3^2=151$$ $$13^22*7^2=71$$ $$13^22*9^2=7$$
We can keep y constant and vary the multiplier n (we skip the values of n that do not produce a prime like 4,6).
$$13^22*3^2=151$$ $$13^28*3^2=97$$ $$13^210*3^2=79$$ $$13^212*3^2=61$$ $$13^214*3^2=43$$
There is nothing special about the square $13^2$. We can use some other square.
$$19^22*1^2=359$$ $$19^22*5^2=311$$ $$19^22*7^2=263$$ $$19^22*9^2=199$$ $$19^22*13^2=23$$
Note: I only wanted to provide examples of primes $p=x^2ny^2$ and to show how easy it is to produce them. I know nothing about the theory behind. I wanted to comment but I don't have enough reps. I posted the method to produce these kind of primes on the mathstackexchange site.
https://math.stackexchange.com/questions/2063770/isthisalgorithmforgeneratingprimesanygood
If this is not the answer expected, please delete it. I don't have a problem with that.