TITLE: Can the Dedekind zeta function distinguish between real and imaginary quadratic number fields?
QUESTION [18 upvotes]: Suppose I am given a machine that gives me the coefficients $a_1$, $a_2$, $a_3$, ... of a Dirichlet series
$$\sum_1^{\infty} \frac{a_n}{n^s} $$
and assume that I know that this Dirichlet series is the Dedekind zeta function of a quadratic number field. Is there any kind of algorithm which allows me to determine whether the number field is real or imaginary?

REPLY [11 votes]: Asking in terms of $B$ how many $a_n$ are needed is equivalent to asking the following question: 
What is the largest $N$ such that there exists two quadratic characters  $\chi_1, \chi_2$ of conductor $<B$ with $\chi_1(n)=\chi_2(n)$ for $n<N$  but $\chi_1(-1)\neq \chi_2(-1)$?
An obvious approach is to note that then $\chi= \chi_1 \chi_2^{-1}$ is a character of conductor $<B^2$  with $\chi(n)=1$ for $n<m$, which by the bound for the least quadratic nonresidue problem can only happen for $n< \left(B^2\right)^{1/4\sqrt{e}+o(1)}=B^{1/2\sqrt{e}+o(1)}$
Of course any improvement on this problem would also represent improvement on the least quadratic nonresidue problem, at least for residues modulo primes congruent to $3$ modulo $4$.
Given this many you could perform the algorithm of enumerating all the characters of conductor $<B$ and seeing which agree with your sequence.
The only efficient algorithm I see requires  $B$ coefficients - you simply look to see for which primes $\chi(p)$ is $0$ (or $a_p$ is $0$ for the Dirichlet $L$-function). These are precisely the ramified primes. If you check up to $B$ you find all the ramified primes. Knowing the ramified primes determines the Dirichlet character up to multiplication by a Dirichlet character modulo $8$, since $2$ is the only prime that can be ramified in multiple different ways. Simply check the four possibilities to see which one matches the first few coefficients of your sequence.