Alternately, values of n such that if for some number N, 4*N can be written as x^2+n*y^2, then for every prime factor p of N which occurs to an odd power, 4*p can be written as x^2+n*y^2.
For these values of n, for all primes p for which n is a quadratic residue (mod p), 4*p can be written as x^2+n*y^2.
For n = 1, 2, 3 all primes p for which n is a quadratic residue (mod p) can be written as x^2+n*y^2, with 4*p = (2*x)^2+n*(2*y)^2.
n = 1, 2, 3 are also the only values of n for which if some positive integer N can be written in the form a^2+n*b^2, for some integers a and b, then every prime factor P of N which occurs to an odd power can be written in the form c^2+n*d^2, for some integers c and d.
For n = 4, 7 all primes p for which n is a quadratic residue (mod p) except for p = 2 can be written as x^2+n*y^2, with 4*p = (2*x)^2+n*(2*y)^2. For p = 2, 4 * 2 = 8 = 2^2 + 4*1^2 = 1^2 + 7*1^2.
For n = 8, all primes p (except for p = 2), for which n is a quadratic residue (mod p) are generated by either x^2+8*y^2 or 3*x^2+2*x*y+3*y^2. We have 4*(x^2+8*y^2) = (2*x)^2+8*(2*y)^2 and 4*(3*x^2+2*x*y+3*y^2) = (2*x2*y)^2+8*(x+y)^2. For p = 2, 4 * 2 = 8 = 0^2 + 8*1^2.
For n = 12, all primes p (except for p = 2), for which n is a quadratic residue (mod p) are generated by either x^2+12*y^2 or 3*x^2+4*y^2. We have 4*(x^2+12*y^2) = (2*x)^2+12*(2*y)^2 and 4*(3*x^2+4*y^2) = (4*y)^2+12*x^2. We do not need to consider the prime p = 2 because numbers of form x^2+12*y^2 cannot contain prime factor of 2 raised to an odd power, as 12 is of the form 4^s*(8*t+3).
For n = 11, all primes p for which n is a quadratic residue (mod p) are generated by either x^2+11*y^2 or 3*x^2+2*x*y+4*y^2. We have 4*(x^2+11*y^2) = (2*x)^2+11*(2*y)^2 and 4*(3*x^2+2*x*y+4*y^2) = (x+4*y)^2+11*x^2.
For n = 19, all primes p for which n is a quadratic residue (mod p) are generated by either x^2+19*y^2 or 4*x^2+2*x*y+5*y^2. We have 4*(x^2+19*y^2) = (2*x)^2+19*(2*y)^2 and 4*(4*x^2+2*x*y+5*y^2) = (4*x+y)^2+19*y^2.
For n = 43, all primes p for which n is a quadratic residue (mod p) are generated by either x^2+43*y^2 or 4*x^2+2*x*y+11*y^2. We have 4*(x^2+43*y^2) = (2*x)^2+43*(2*y)^2 and 4*(4*x^2+2*x*y+11*y^2) = (4*x+y)^2+43*y^2.
For n = 67, all primes p for which n is a quadratic residue (mod p) are generated by either x^2+67*y^2 or 4*x^2+2*x*y+17*y^2. We have 4*(x^2+67*y^2) = (2*x)^2+67*(2*y)^2 and 4*(4*x^2+2*x*y+17*y^2) = (4*x+y)^2+67*y^2.
For n = 163, all primes p for which n is a quadratic residue (mod p) are generated by either x^2+163*y^2 or 4*x^2+2*x*y+41*y^2. We have 4*(x^2+163*y^2) = (2*x)^2+163*(2*y)^2 and 4*(4*x^2+2*x*y+41*y^2) = (4*x+y)^2+163*y^2.
