TITLE: Questions involving primes $p\equiv1\pmod4$
QUESTION [6 upvotes]: As claimed by Fermat and proved by Euler, any prime $p\equiv1\pmod4$ can be written uniquely as $s_p^2+t_p^2$ with $s_p,t_p\in\{1,2,3,\ldots\}$, $2\nmid s_p$ and $2\mid t_p$. For any positive integer $n$, let us define
$$S(n):=\sum_{p\le n\atop p\equiv1\pmod4}s_p
\ \ \ \text{and}\ \ \ T(n)=\sum_{p\le n\atop p\equiv1\pmod4}t_p.$$
Via computation, I have found that
$$S(10^9)=334976550299,\ \ T(10^9)=334979004134,\ \ \frac{S(10^9)}{T(10^9)}\approx 0.99999267.$$
This leads me to pose the following conjecture.
Conjecture. We have
$$\lim_{n\to+\infty}\frac{S(n)}{T(n)}=1.$$
QUESTION 1. Is the conjecture true? If true, how to prove it?
I have another question.
QUESTION 2. Is there a positive contant $c$ such that 
$$\lim_{n\to+\infty}\frac{\sum_{p\le n\atop p\equiv1\pmod4}s_t/t_p}{\sum_{p\le n\atop p\equiv1\pmod4}t_p/s_p}=c$$
holds? 
Concerning this question, I conjecture that $c$ exists and its value is probably $1$. I have found that
$$\frac{\sum_{p\le 10^{11}\atop p\equiv1\pmod4}s_t/t_p}{\sum_{p\le 10^{11}\atop p\equiv1\pmod4}t_p/s_p}\approx 0.896.$$
Your comments are welcome!

REPLY [2 votes]: For $p\equiv1\bmod4$,
we write
$$p=s_p^2+t_p^2=\sigma_p\overline{\sigma}_p,\ \ \ \sigma_p\in\mathbf{Z}[i].$$
Note that $\sigma_p$ and $2$ are coprime in $\mathbf{Z}[i].$ For each positive integer $k$, we would like to evaluate
$$ S_k(x):=\sideset{}{'}\sum_{\substack{\sigma_p\in\mathbf{Z}[i],\sigma_p\overline{\sigma}_p\leqslant x,\\ \sigma_p+\overline{\sigma}_p\equiv0\bmod4}}(\Re\sigma_p)^k
=\sideset{}{'}\sum_{\substack{\sigma_p\in\mathbf{Z}[i],\sigma_p\overline{\sigma}_p\leqslant x,\\ \sigma_p+\overline{\sigma}_p\equiv0\bmod4}}(\sqrt{p}\cos\theta_p)^k, $$
where $'$ yields the restriction that $\arg(\sigma_p)\in(0,\pi/2).$
On the other hand,
$$\sigma_p+\overline{\sigma}_p\equiv0\bmod4\Leftrightarrow \sigma_p^2+p\equiv0\bmod4\Leftrightarrow \sigma_p^2+1\equiv0\bmod4.$$
The last congruence is viewed $\mathbf{Z}[i]$, so that
$$S_k(x)=\frac{1}{4}\sideset{}{'}\sum_{\substack{\sigma_p\in\mathbf{Z}[i],\sigma_p\overline{\sigma}_p\leqslant x,\\ \sigma_p^2+1\equiv0\bmod4}}(\sqrt{p}\cos\theta_p)^k.$$
Introducing multiplicative characters in $(\mathbf{Z}[i]/4\mathbf{Z}[i])^\times$, we may write
$$ S_k(x)=\frac{1}{4}\frac{1}{\Phi(4)}\sum_{\chi\in\widehat{(\mathbf{Z}[i]/4\mathbf{Z}[i])^\times}}\sum_{z\in\mathbf{Z}[i],z^2+1\equiv0\bmod4}\overline{\chi}(z)\sideset{}{'}\sum_{\sigma_p\in\mathbf{Z}[i],\sigma_p\overline{\sigma}_p\leqslant x}\chi(\sigma_p)(\sqrt{p}\cos\theta_p)^k,$$
where $\Phi(4)=|(\mathbf{Z}[i]/4\mathbf{Z}[i])^\times|=8.$
For each $\chi$, the sum 
$$
\sideset{}{'}\sum_{\sigma_p\in\mathbf{Z}[i],\sigma_p\overline{\sigma}_p\leqslant x}\chi(\sigma_p)(\cos\theta_p)^k,
$$
can be evaluated via Hecke's argument since
\begin{align*}
\chi(\sigma_p)e^{\ell i\theta_p}=\chi(\sigma_p)\Big(\frac{\sigma_p}{|\sigma_p|}\Big)^\ell
\end{align*}
gives a Hecke Grossencharacter at evaluated at $\sigma_p.$
Similarly, we can also consider
\begin{align*}
T_k(x):=\sideset{}{'}\sum_{\substack{\sigma_p\in\mathbf{Z}[i],\sigma_p\overline{\sigma}_p\leqslant x\\ \sigma_p-\overline{\sigma}_p\equiv0\bmod4}}(\Im\sigma_p)^k,
\end{align*}
which is related to the congruence $z^2-1\equiv0\bmod4.$
After a collection of serious arguments, we find the limit is equal to the ratio $|\mathcal{A}|/|\mathcal{B}|$
with
$$\mathcal{A}=\{z\bmod4:z^2+1\equiv0\bmod4\},\ \ \ \mathcal{B}=\{z\bmod4:z^2-1\equiv0\bmod4\}.$$
In fact,
\begin{align*}
\mathcal{A}=\{i,3i,2+i,2+3i\bmod4\},\ \ \ \mathcal{B}=\{1,1+i,3,3+2i\bmod4\}.
\end{align*}
Hence $|\mathcal{A}|/|\mathcal{B}|=1,$ which proves the first conjecture.