Mistake while computing residue of Dedekind Zeta function I want to calculate the following limit:
$$\lim_{s \to 1^+} (s-1)\zeta_K(s)  $$ where $K=\mathbb{Q}(i)$ with Dedekind Zeta function of it, $\zeta_K(s)$. We know that $\zeta_K(s)$ has a simple pole at $1$ and its residue can be found by class number formula given by $\cfrac{2^{r_1}(2\pi)^{r_2}Rh}{m\sqrt{(|\Delta)|}}$ where $r_1$ is the number of real embeddings of the field, $r_2$ for complex -nonconjugate- ones; $R$ for the regulator of $K, h$ is the class number of $K$, $m$ is the number of roots of unity in $K$ and $\Delta$ is the discriminant of $K$.
So, we have $r_1 =0, r_2 =1$. I found that $R$ is equal to $1$. $\mathbb{Z}[i]$ is PID so $h=1$. $\mathbb{Q}(i)$ has $\{1,-1,i,-i\}$ as roots of unity so $m=4$ and finally $\Delta  =-4$. Writing it all up, we get:
$$\cfrac{2^{0}.(2\pi)^{1}.1.1}{4\sqrt{(|-4)|}} = \cfrac{\pi}{4}$$.
On the other hand, I define another function $Z(s)=\displaystyle\sum_{x,y \in \mathbb{Z}^{>0}}\cfrac{1}{(x^2 + y^2)^s}$.
After few manipulation, I bounded $(s-1)Z(s)$ above and below with "usual" $\zeta$-function and concluded that $ \cfrac{1}{4} \le \lim_{s \to  1^+}(s-1)Z(s) \le 1$. With the help of a theorem, which I can state it in the comments if necessary,  $\lim_{s \to  1^+}(s-1)Z(s)$ is actually $\cfrac{\pi}{4}$.
Now, here comes the my question:
$\displaystyle\zeta_K(s) = \sum_{0 \ne I \subseteq \mathcal{O}_K} \cfrac{1}{N(I)^s}$ $K$ is PID so every ideal $I$ is of the form $(a+ bi)$ for some $a,b \in \mathbb{Z}$. Thus, we actually have
$$\displaystyle\zeta_K(s) = \sum_{0 \ne I \subseteq \mathcal{O}_K} \cfrac{1}{N(I)^s}= \sum_{a,b \in \mathbb{Z}-\{0\}} \cfrac{1}{N(a+bi)^s}=\sum_{a,b \in \mathbb{Z}-\{0\}} \cfrac{1}{(a^2 +b^2)^s}$$. 
It looks quite similar to our first function $Z(s)=\displaystyle\sum_{x,y \in \mathbb{Z}^{>0}}\cfrac{1}{(x^2 + y^2)^s}$ with some difference, we are now summing over all integers, not the ones in the first quadrant. Therefore, I am expecting that I should get $Res_{s=1}(\zeta_K(s)) = 4 \times Res_{s=1}(Z(s)) = 4 \times \cfrac{\pi}{4} = \pi$. However, in the beginning, we found that $Res_{s=1}(\zeta_K(s)) = \cfrac{\pi}{4}$.
So, what am I missing, what do I wrong? Thank you.
 A: You write
$$\zeta_K(s)=\cdots=\sum_{a,b\in\Bbb Z-\{0\}}\frac1{(a^2+b^2)^s}.$$
But this isn't the case. Each nonzero ideal is $(a+bi)$ for four
different $(a,b)\in\Bbb Z^2-\{(0,0)\}$, since $\Bbb Z[i]$ has four units,
so
$$\zeta_K(s)=\frac14\sum_{a,b\in\Bbb Z-\{0\}}\frac1{(a^2+b^2)^s}.$$
A: Since $\mathcal{O}_K = \mathbb{Z}[i]$ is a PID with finite unit group then $$\zeta_K(s) = \sum_{I \subset \mathcal{O}_K} N(I)^{-s}=\frac{1}{|\mathcal{O}_K^\times|} \sum_{a \in \mathcal{O}_K \setminus \{0\}} N(a)^{-s}$$
Also
$$\lim_{s \to 1}(s-1)\sum_{a \in \mathcal{O}_K \setminus \{0\}} N(a)^{-s}\\ = \lim_{s \to 1}(s-1) \int_{\mathbb{R}^2, \|x\| > 1} \|x\|^{-2s}dx\\+\sum_{a \in \mathcal{O}_K \setminus \{0\}} (N(a)^{-s}-\int_{[0,1]^2} \|x+(\Re(a),\Im(a))\|^{-2s}1_{\|x+(\Re(a),\Im(a))\| < 1}dx)$$
$$=\lim_{s \to 1}(s-1) \int_{\mathbb{R}^2, \|x\| > 1} \|x\|^{-2s}dx = \pi$$
To understand $\cfrac{2^{r_1}(2\pi)^{r_2}Rh}{m\sqrt{(|\Delta)|}}$ you need to look at the associated theta function $\sum_{a \in \mathcal{O}_K} e^{-\pi \sum_{j} |\sigma_j(a)|^2 x_j}$ where $\sigma$ are the complex and real embeddings
