What is the set of all integers that can be written in the form $m^2+2n^2$? Here $m$, $n\in \mathbb{Z}$. Further more, what about $m^2+kn^2$ for some $k\in \mathbb{Z}^{+}$?
I think the first question might has some relation with $\mathbb{Z}[\sqrt{-2}]$ is a PID? Suppose this set is $A$ I guess if $p$ is a prime number and $p^2\in A$ then $p\in A$ by some specific example. I do not know how to prove this. Maybe the second question has no answer for a random $k$.
Appreciating for every help and idea.
The general idea is that there are three kinds of obstructions to an integer not being represented in the form $ m^2 + kn^2 $: Either there is a modular obstruction due to quadratic residues (for instance, $ 5 $ can't be represented as $ m^2 + 2n^2 $ because this would imply $ -2 $ is a quadratic residue modulo $ 5 $, which is false), there is a class group obstruction, or there is an integrality obstruction (the last two are related). When the ring $ \mathbf Z[\sqrt{-k}] $ is a principal ideal domain, which is an exceptional situation that doesn't arise unless $ k = 1 $ or $ k = 2 $, then neither the class group obstruction nor the integrality obstruction exist, and the numbers represented by the quadratic form are precisely those that don't contradict quadratic reciprocity.
For instance, in the case $ k = 2 $, this means a number may be represented as $ m^2 + 2n^2 $ if and only if the exponents of all primes that are $ 5 $ or $ 7 $ mod $ 8 $ (primes modulo which $ -2 $ is not a quadratic residue) in its prime factorization are even. More explicitly, if $ c = \prod_k p_k^{r_k} $ for distinct primes $ p_k $, then $ c $ may be represented in the form $ m^2 + 2n^2 $ if and only if whenever $ p_k \equiv 5, 7 \pmod {8} $, we have $ r_k \equiv 0 \pmod{2} $.
To generalize it to all $ k $ requires an understanding of the class groups of the imaginary quadratic number rings and their orders, which doesn't exist in general, but in specific cases it's possible to apply an algorithm of Gauss (quadratic form reduction) to determine if some specific integer may be represented by some specific quadratic form. It doesn't result in this kind of elegant description, however; essentially because by looking at "actual integers" instead of "ideal integers" (as Kummer described ideals in number rings), you're seeing the arithmetic behavior through a somewhat distorted lens.