# Counting Rational Points on the Stacky
$\operatorname{Sym}^{2}{\mathbb{P}}^{1}$

John Yin111The author is affiliated with the University of Wisconsin-Madison

###### Abstract

We prove the weak form of the generalized Batyrev-Manin-Malle conjecture
formulated in [6] for the stack
$\operatorname{Sym}^{2}{\mathbb{P}}^{1}:=({\mathbb{P}}^{1}\times{\mathbb{P}}^{1})/S_{2}$,
where the $S_{2}$ action just permutes the two coordinates. In particular, we
show that the diagonal $\Delta\subset\operatorname{Sym}^{2}{\mathbb{P}}^{1}$
is an accumulating substack.

###### Contents

  1. 1 Introduction
  2. 2 Notations and Conventions
  3. 3 Overview
  4. 4 Estimate of $|S_{x}|$ for $1\leq x\leq B^{2/3-\epsilon}$
  5. 5 Estimate of $|S_{x}|$ for $-1\geq x\geq B^{2/5-\epsilon}$
  6. 6 Upper Bound of $|S_{y}|$ for $1\leq y\leq B^{5/19-\epsilon}$
    1. 6.1 $c\leq(By)^{1/3}$
    2. 6.2 $(By)^{1/3}\leq c\leq\frac{B^{1/2-\delta}}{y^{3/10}}$
    3. 6.3 $\frac{B^{1/2-\delta}}{y^{3/10}}\leq c\leq B^{1/2}$
    4. 6.4 Proof of Proposition 3.10
  7. 7 Lower Bound
  8. 8 Appendix A

##  1 Introduction

Let ${\mathfrak{X}}$ be the stack
$\operatorname{Sym}^{2}{\mathbb{P}}^{1}:=({\mathbb{P}}^{1}\times{\mathbb{P}}^{1})/S_{2}$,
where $S_{2}$ is the symmetric group with two elements, acting via permutation
of coordinates. In this paper, we will prove the weak form of the generalized
Batyrev-Manin-Malle conjecture formulated in [6] for ${\mathfrak{X}}$. There
is also a stacky Batyrev-Manin conjecture formulated in [5], which further
predicts the existence of a leading constant. We do not prove this stronger
conjecture, though our proof does not give any indication that the leading
constant does not exist. Other point counts with respect to the stacky height
defined in [6] has been done. [11] establishes asymptotic bounds on point
counts of ${\mathbb{P}}^{1}_{{\mathbb{Q}}}$ with $3$ stacky points
$\\{0,1,\infty\\}$ and the residue gerbes all equal to $\mu_{2}$. [12]
establishes point counts of weighted projective spaces. [2] establishes
asymptotic bounds on point counts on certain modular curves.

We perform this count by considering the data that ${\mathfrak{X}}$
parametrizes. That is, for any field $k$, the $k$-points of ${\mathfrak{X}}$
correspond to a quadratic étale extension, along with an element in that
extension. Most of the time, the element in the extension determines the
quadratic étale extension, unless that element is in $k$. Thus, counting
algebraic numbers of degree $2$ over $k$ essentially correspond to counting
the $k$-points of ${\mathfrak{X}}$. Counting algebraic numbers of a fixed
degree and bounded absolute height over ${\mathbb{Q}}$ was first done in [9].
The authors approach this problem by counting the polynomials of a fixed
degree whose roots have bounded absolute height, instead of the algebraic
numbers themselves. Such polynomials have coefficients varying in a “nice”
region, and they are able to apply the principle of Lipschitz to obtain bounds
on the number of such polynomials.

In this paper, we will carry out essentially the same count, except with
respect to the stacky height in [6]. The main difficulty is that while Masser
and Vaaler dealt with only the absolute height of an algebraic number, the
stacky height involves both the absolute height and the discriminant of the
number field the algebraic number generates. Thus, parametrizing by
polynomials does not lead to nice regions, as the discriminant of the number
field generated by a polynomial is a very discontinuous function in terms of
the coefficients of the polynomial. As a result, we have to employ different
methods, resulting in worse asymptotic bounds than those in [9]. However,
these bounds turn out to be enough to prove the weak form of the generalized
Batyrev-Manin-Malle conjecture in the context of
${\mathfrak{X}}=\operatorname{Sym}^{2}{\mathbb{P}}^{1}$.

Furthermore, in the setting of Batyrev-Manin conjecture, which deals with
point counts on a Fano variety $X$, there is a notion of “accumulating
subvariety” $C\subset X$. It turns out that it could happen that “most” of the
points of bounded height lie on this $C$, despite the fact that it is of a
lower dimension. In these cases, the Batyrev-Manin conjecture makes
predictions of points on $X\setminus C$. In our case, we will show that the
diagonal $\Delta\subset\operatorname{Sym}^{2}{\mathbb{P}}^{1}$ is an
“accumulating substack.” We will show that point counts on this substack are
on the order of $B^{2}$ in Theorem 3.3, using just elementary number theory.
Points off this substack correspond to points in the quadratic étale extension
${\mathbb{Q}}^{2}$, which we call “split points,” or an algebraic number in a
quadratic number field, which we call “non-split points.” We will show that
the number of split, non-diagonal points is on the order of $B\log B$ in
Theorem 3.4. Finally, we will show that the number of non-split, non-diagonal
points corresponding to quadratic field extensions is $\Theta(B\log B)$ in
Theorem 3.5. Theorem 3.4 also just uses elementary number theory, while
Theorem 3.5 is the hardest to prove, and is the main goal of this paper.

The approach we to tackle our main theorem is by separating the non-split,
non-diagonal points of $\operatorname{Sym}^{2}{\mathbb{P}}^{1}$ we count into
two pieces. The non-split points of
$\operatorname{Sym}^{2}{\mathbb{P}}^{1}({\mathbb{Q}})$ now truly do correspond
to algebraic numbers $\alpha$ of degree $2$, and so correspond further to just
quadratic polynomials up to scaling by taking their minimal polynomial.
Furthermore, the heights of elements of
$\operatorname{Sym}^{2}{\mathbb{P}}^{1}({\mathbb{Q}})$, expressed in terms of
their minimal polynomials $ax^{2}+bx+c$ representing them, is approximately
$H(a:b:c)^{2}\sqrt{|\operatorname{sqf}(b^{2}-4ac)|}$, where $H(a:b:c)$ is the
usual height on ${\mathbb{P}}^{2}$ and $\operatorname{sqf}$ denotes the
squarefree part. Thus, the two pieces we separate into are a piece containing
quadratic polynomials $f$ where $|\operatorname{sqf}(b^{2}-4ac)|$ is small,
and a piece where $|\operatorname{sqf}(b^{2}-4ac)|$ is big. In the situation
that $|\operatorname{sqf}(b^{2}-4ac)|$ is small, we use L-functions to
parametrize quadratic polynomials which generate a quadratic extension $k$
with fixed discriminant, then apply a Tauberian theorem. In the situation that
$|\operatorname{sqf}(b^{2}-4ac)|$ is big, we switch perspectives and notice
that $b^{2}-4ac$ is divisible by a small square, and count quadratic
polynomials of bounded height whose discriminant is divisible by a small
square.

The methods in this paper does not immediately allow one to prove weak form of
the generalized Batyrev-Manin-Malle conjecture for higher
$\operatorname{Sym}^{n}{\mathbb{P}}^{1}$. This problem is in general
difficult. An element of
$\operatorname{Sym}^{n}{\mathbb{P}}^{1}({\mathbb{Q}})$ is a pair $(k,\alpha)$,
where $k$ is an ètale extension of degree $n$, and $\alpha$ is an element of
$k$. The height of such a pair $(k,\alpha)$ is
$H_{\operatorname{abs}}(\alpha)^{2n}\sqrt{|\Delta_{k}|},$ where
$H_{\operatorname{abs}}$ is the absolute height and $\Delta_{k}$ is the
absolute discriminant of $k$. By [13], there exists a primitive element
$\alpha_{k}$ of height bounded by $O(|\Delta_{k}|^{1/2n})$ in $k$. So, the
height of the pairs $(k,\alpha_{k})$ would be $O(|\Delta_{k}|^{3/2})$. Now,
the weak form of the generalized Batyrev-Manin-Malle conjecture in this case
would predict that the number of such pairs of height bounded by $B$ is in
particular bounded by $B\log B$, and so there must be at most $B\log B$
extensions of degree $n$ whose discriminant is bounded by $B^{2/3}$. In other
words, the number of extensions of bounded degree and discriminant
$O(B^{3/2}\log B)$, independent of $n$. Thus, the weak form of the generalized
Batyrev-Manin-Malle conjecture for $\operatorname{Sym}^{n}{\mathbb{P}}^{1}$ is
much stronger than the state of the art bounds [8] on the number of number
fields of fixed degree $n$ and bounded discriminant $B$, which is currently
$O(B^{c\log(n)^{2}})$.

Acknowledgements. We would like to thank Jordan Ellenberg, Jianhui Li, and
Simon Marshall for helpful discussions.

##  2 Notations and Conventions

Let $f,g:{\mathbb{Z}}^{\geq 0}\to{\mathbb{R}}$ be functions.

  * •

We say $f(n)=O(g(n))$ if there exists $c>0$, $k$ so that $f(n)\leq cg(n)$ for
all $n\geq k$.

  * •

We say $f(n)=\Omega(g(n))$ if there exists $c>0$, $k$ so that $f(n)\geq cg(n)$
for all $n\geq k$.

  * •

We say $f(n)=\Theta(g(n))$ if $f(n)=O(g(n))$ and $f(n)=\Omega(g(n))$.

  * •

We will use $f(n)=O_{\epsilon,\delta,\dots}(g(\epsilon,\delta,\dots,n))$ to
denote that the constant $c$ is dependent on $\epsilon,\delta,\dots$.

  * •

We will use $\phi(n)$ to denote the Euler phi function, so that
$\phi(n)=|({\mathbb{Z}}/n{\mathbb{Z}})^{\times}|$.

  * •

We will denote $\omega(n)=\\#\\{p\text{ prime}:p|n\\}$.

  * •

We will use $\mu(n)$ to denote the Mobius function, so that $\mu(n)=0$ if $n$
is not squarefree, and $\mu(n)=(-1)^{\omega(n)}$ otherwise.

  * •

We will use $\operatorname{sqf}(n)$ to denote the squarefree part of $n$. More
explicitly, this is a multiplicative function so that
$\operatorname{sqf}(p^{k})=\begin{cases}1&2|k\\\ p&2\nmid k\end{cases}$ We
also define $\operatorname{sqf}(-1)=-1$, so that
$\operatorname{sqf}(-n)=-\operatorname{sqf}(n)$.

  * •

Define also $\operatorname{sq}(n)=\sqrt{n/\operatorname{sqf}(n)}$. This is an
integer by the definition of $\operatorname{sqf}$.

  * •

We define $\operatorname{Res}_{s=a}f(s)$ to be the residue of $f$ at $a$. In
other words, $\operatorname{Res}_{s=a}f(s):=\lim_{s\to a}(s-a)f(s)$.

  * •

We will always denote height functions with letters $h$ and $H$. Whenever we
define $h$, we will define $H(x)$ to be $e^{h(x)}$.

##  3 Overview

Let
${\mathfrak{X}}:=\operatorname{Sym}^{2}{\mathbb{P}}^{1}=({\mathbb{P}}^{1}\times{\mathbb{P}}^{1})/S_{2}$,
where $S_{2}$ acts on the two coordinates by permuting them. We will study
point counts on this stack.

######  Definition 3.1.

A rational point $x\in{\mathfrak{X}}({\mathbb{Q}})$ corresponds to a
$S_{2}$-equivariant map
$f:\operatorname{Spec}(K)\to{\mathbb{P}}^{1}\times{\mathbb{P}}^{1}$, where $K$
is a degree $2$ etale extension of ${\mathbb{Q}}$. If
$K={\mathbb{Q}}\oplus{\mathbb{Q}}$, then we call $x$ a split point. Otherwise,
we call $x$ non-split. Furthermore, if the map
$\operatorname{Spec}(K)\to{\mathbb{P}}^{1}\times{\mathbb{P}}^{1}$ factors
through $\operatorname{Spec}(K)\to\operatorname{Spec}({\mathbb{Q}})$, we call
$x$ a diagonal point.

We may describe non-split points $x$ by the $S_{2}$-equivariant map
$f:\operatorname{Spec}(K)\to{\mathbb{P}}^{1}\times{\mathbb{P}}^{1}$,
corresponding to an ordered pair
$(\alpha,\beta)\in{\mathbb{P}}^{1}(K)\times{\mathbb{P}}^{1}(K)$, which are
equivariant under the two actions

  1. 1.

$(\alpha,\beta)\to(\bar{\alpha},\bar{\beta})$

  2. 2.

and $(\alpha,\beta)\to(\beta,\alpha)$.

In conclusion, the datum of an non-split point is equal to the datum of a
single $\alpha\in{\mathbb{P}}^{1}(K)$. The same reasoning applies for split
points, except given $(a_{0},a_{1})\in{\mathbb{P}}^{1}({\mathbb{Q}})$, the
notation $\overline{(a_{0},a_{1})}$ is just $(a_{1},a_{0})$. In this case we
obtain that the datum of a split point is equal to the datum of an ordered
pair
$(a_{0},a_{1})\in{\mathbb{P}}^{1}({\mathbb{Q}})\times{\mathbb{P}}^{1}({\mathbb{Q}})$.

Let $K$ be a global field. For $x\in{\mathfrak{X}}(K)$, we define $h(x)$ to be
the height associated to the tangent bundle of ${\mathfrak{X}}$. By the
calculations in [6, Section 3.6], we obtain that given a point
$x\in{\mathfrak{X}}({\mathbb{Q}})$,

$h(x)=\begin{cases}2h_{\operatorname{abs}}(a)+2h_{\operatorname{abs}}(b)&x\in{\mathfrak{X}}({\mathbb{Q}})\text{
split, associated with
}(a,b)\in{\mathbb{P}}^{1}({\mathbb{Q}})\times{\mathbb{P}}^{1}({\mathbb{Q}})\\\
4h_{\operatorname{abs}}(\alpha)+\frac{1}{2}\log|\Delta_{{\mathbb{Q}}[\alpha]}|&x\in{\mathfrak{X}}({\mathbb{Q}})\text{
non-split, associated with }\alpha\in{\mathbb{P}}^{1}(K)\end{cases},$

where $h_{\operatorname{abs}}$ is the logarithmic absolute Weil height.

Now define $H_{\operatorname{abs}}(x)=e^{h_{\operatorname{abs}}(x)}$ to be the
exponential Weil height, and also define $H(x)=e^{h(x)}$. Our goal is to count
${\mathfrak{X}}({\mathbb{Q}})$ with respect to $H(x)$. Counting split and
diagonal points is easy, involving only some elementary number theory, and we
may obtain the exact asymptotic. However, counting non-split points is more
difficult and instead we only obtain an asymptotic upper and lower bound with
the same magnitude.

We begin with the main statement of the paper, which shows that the diagonal
is an accumulating subset.

######  Theorem 3.2.

Assuming GRH, we have that

$\\{x\in{\mathfrak{X}}({\mathbb{Q}}):x\text{ diagonal},H(x)\leq
B\\}=\Theta(B^{2}),$

and

$\\{x\in{\mathfrak{X}}({\mathbb{Q}}):x\text{ off-diagonal},H(x)\leq
B\\}=\Theta(B\log B).$

###### Proof.

This is just the combination of Theorems 3.3, 3.4, and 3.5. ∎

######  Theorem 3.3.

Let $c=\sum_{x=1}^{\infty}\frac{\phi(x)}{x^{8}}$. Then,

$\\{x\in{\mathfrak{X}}({\mathbb{Q}}):x\text{ diagonal},H(x)\leq
B\\}=2cB^{2}+O(B)$

###### Proof.

Let $x$ be a diagonal point. Then, $x$ is a map
$x:\operatorname{Spec}(K)\to{\mathbb{P}}^{1}\times{\mathbb{P}}^{1}$ whose
image is a rational point of the form $(r,r)$, where
$r\in{\mathbb{P}}^{1}({\mathbb{Q}})$ (here $K$ may be
${\mathbb{Q}}\times{\mathbb{Q}}$). Also let $r=a/b$, where $a,b$ in lowest
form. Then, the height $H(x)$ is
$H_{\operatorname{abs}}(r)^{4}\sqrt{|\Delta_{K}|}$. Thus, we must count the
following set

$\\{(r,K):[K:{\mathbb{Q}}]=2,\max(a,b)^{4}|\Delta_{K}|^{1/2}\leq B\\}.$

This count is

$\sum_{x=1}^{B^{1/4}}2\phi(x)\\#\\{K:[K:{\mathbb{Q}}]=2,|\Delta_{K}|\leq
B^{2}/x^{8}\\}.$

It is well known that

$\\#\\{K:[K:{\mathbb{Q}}]=2,|\Delta_{K}|\leq
B^{2}/x^{8}\\}=\frac{1}{\zeta(2)}\frac{B^{2}}{x^{8}}+O(\frac{B}{x^{4}}).$

Thus, we need to find

$\sum_{x=1}^{B^{1/4}}2\phi(x)\frac{B^{2}}{x^{8}}+O(\sum_{x=1}^{B^{1/4}}2\phi(x)\frac{B}{x^{4}})=A+O(E).$

First we estimate $A$. We have

$\displaystyle\sum_{x=1}^{B^{1/4}}\frac{\phi(x)}{x^{8}}$
$\displaystyle=c-\sum_{x=B^{1/4}}^{\infty}\frac{\phi(x)}{x^{8}}$
$\displaystyle=c+O(\sum_{x=B^{1/4}}^{\infty}\frac{1}{x^{7}})$
$\displaystyle=c+O(B^{-3/2})$

Thus, $A=2cB^{2}+O(\sqrt{B})$.

Now we estimate $E$.

$E=\sum_{x=1}^{B^{1/4}}2\phi(x)\frac{B}{x^{4}}=O(B).$

Thus, $A+E=2cB^{2}+O(B)$, as desired. ∎

######  Theorem 3.4.

$\\{x\in{\mathfrak{X}}({\mathbb{Q}}):x\text{ split and nondiagonal},H(x)\leq
B\\}=\frac{1}{\zeta(2)^{2}}B\log B+O(B)$

###### Proof.

Here, we are counting pairs of rational points $(r,s)$ so that
$H_{\operatorname{abs}}(r)^{2}H_{\operatorname{abs}}(s)^{2}\leq B$. Writing
$r=a/b$ and $s=c/d$ where $a/b$ and $c/d$ are fractions in lowest terms, we
see that we need to count

$\\{(a,b,c,d):(a,b)=1,(c,d)=1,\max(a,b)^{2}\max(c,d)^{2}\leq B\\}.$

This count is

$\displaystyle\sum_{x=1}^{\sqrt{B}}\sum_{y=1}^{\sqrt{B}/x}\\#\\{(a,b):(a,b)=1,$
$\displaystyle\max(a,b)=x\\}\\#\\{(c,d):(c,d)=1,\max(c,d)=y\\}$
$\displaystyle=4\sum_{x=1}^{\sqrt{B}}\sum_{y=1}^{\sqrt{B}/x}\phi(x)\phi(y)$
$\displaystyle=4\sum_{x=1}^{\sqrt{B}}\phi(x)\sum_{y=1}^{\sqrt{B}/x}\phi(y).$

The fact that

$\sum_{y=1}^{\sqrt{B}/x}\phi(y)=\frac{1}{2\zeta(2)}(\sqrt{B}/x)^{2}+O((\sqrt{B}/x)\log(\sqrt{B}/x))$

is standard. Thus, we get

$4\sum_{x=1}^{\sqrt{B}}\phi(x)\left(\frac{1}{2\zeta(2)}\left(\frac{\sqrt{B}}{x}\right)^{2}+O\left(\frac{\sqrt{B}}{x}\log(\sqrt{B}/x)\right)\right)$
$=\frac{2B}{\zeta(2)}\sum_{x=1}^{\sqrt{B}}\frac{\phi(x)}{x^{2}}+O(\sum_{x=1}^{\sqrt{B}}\phi(x)\frac{\sqrt{B}\log(\sqrt{B}/x)}{x})=A+O(E),$
(3.1)

where we denote $A$ to be the first term and $E$ to be the second term.

First we estimate $A$. Using summation by parts, we have that

$\displaystyle\sum_{x=1}^{\sqrt{B}}\frac{\phi(x)}{x^{2}}$
$\displaystyle=O(\frac{\sum_{x=1}^{\sqrt{B}}\phi(x)}{\sqrt{B}^{2}})+\sum_{k=1}^{\sqrt{B}-1}(\frac{1}{k^{2}}-\frac{1}{(k+1)^{2}})\sum_{x=1}^{k}\phi(k)$
$\displaystyle=O(1)+\sum_{k=1}^{\sqrt{B}-1}\frac{2k+1}{k^{2}(k+1)^{2}}(\frac{1}{2\zeta(2)}k^{2}+O(k\log
k))$ $\displaystyle=O(1)+\frac{1}{\zeta(2)}\sum_{k=1}^{\sqrt{B}-1}\frac{1}{k}$
$\displaystyle=\frac{1}{2\zeta(2)}\log(B)+O(1)$

Thus, $A=\frac{1}{\zeta(2)^{2}}B\log B+O(B).$ This is our main term. We
conclude by estimating $E$, which will be an error term.

$\displaystyle E$
$\displaystyle=\sum_{x=1}^{\sqrt{B}}\phi(x)\frac{\sqrt{B}\log(\sqrt{B}/x)}{x}$
$\displaystyle<\sum_{x=1}^{\sqrt{B}}\sqrt{B}\log(\sqrt{B}/x)$
$\displaystyle=B\log(\sqrt{B})-\sqrt{B}\sum_{x=1}^{\sqrt{B}}\log(x)$
$\displaystyle=B\log(\sqrt{B})-\sqrt{B}(\sqrt{B}\log(\sqrt{B})+O(\sqrt{B}))$
$\displaystyle=O(B)$

∎

The rest of the paper will be dedicated to proving the following theorem.

######  Theorem 3.5.

Assuming GRH,

$\\{x\in{\mathfrak{X}}({\mathbb{Q}}):x\text{ non-split and
nondiagonal},H(x)\leq B\\}=\Theta(B\log B).$

###### Proof.

We have by definition that an non-split point is given by an element of a
quadratic extension of ${\mathbb{Q}}$, and an element of a quadratic extension
may be, up to conjugates, identified with its minimal polynomial. Next, by [3,
Prop 1.6.6, Lemma 1.6.7], we have
$H_{\operatorname{abs}}(\alpha)^{2}=\Theta(H_{\operatorname{abs}}([a:b:c]))$
where $\alpha$ is a root of $ax^{2}+bx+c$. We also have that
$|\Delta_{{\mathbb{Q}}[\alpha]}|^{1/2}=\Theta(\sqrt{|\operatorname{sqf}(b^{2}-4ac)|})$.

Thus, we have the asymptotic bounds

$\displaystyle|\\{x\in{\mathfrak{X}}({\mathbb{Q}}):x\text{ non-split and
nondiagonal},H(x)\leq B\\}|=\Theta($
$\displaystyle|\\{(a,b,c)\in{\mathbb{Z}}:a>0,\gcd(a,b,c)=1,$
$\displaystyle\max(|a|,|b|,|c|)^{2}\sqrt{|\operatorname{sqf}(b^{2}-4ac|)|}\leq
B,$ $\displaystyle\operatorname{sqf}(b^{2}-4ac)\notin\\{0,1\\}\\}|)$

Thus, it suffices to upper and lower bound the latter set. To do this, we have
two technical lemmas, which we prove right after this theorem.

######  Lemma 3.6.

We have that

$|\\{(a,b,c)\in{\mathbb{Z}}:a>0,\gcd(a,b,c)=1,\max(|a|,|b|,|c|)^{2}\sqrt{|\operatorname{sqf}(b^{2}-4ac)|}\leq
B,\operatorname{sqf}(b^{2}-4ac)\notin\\{0,1\\}\\}|$
$=O(|\\{(a^{\prime},b,c^{\prime}):\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{\prime
2})\notin\\{0,1\\},\max(|a^{\prime}|,|b|,|c^{\prime}|)^{2}\sqrt{|\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{\prime 2})|}\leq B\\}|).$

######  Lemma 3.7.

We have that

$\displaystyle|\\{(a,b,c)\in{\mathbb{Z}}:a>0,\gcd(a,b,c)=1,\max(|a|,|b|,|c|)^{2}\sqrt{|\operatorname{sqf}(b^{2}-4ac)|}\leq
B,\operatorname{sqf}(b^{2}-4ac)\notin\\{0,1\\}\\}|$
$\displaystyle=\Omega(|\\{(a,b,c):\gcd(a,b)=1,\max(|a|,|b|,|c|)^{2}\sqrt{x}\leq
B,a^{2}+b^{2}\equiv 5\mod 8,$ $\displaystyle\hskip
227.62204pt\operatorname{sqf}(a^{2}+b^{2}-c^{2})\equiv b\equiv 0\mod 2\\}|).$

Now let

$S:=\\{(a^{\prime},b,c^{\prime}):\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{\prime
2})\notin\\{0,1\\},\max(|a^{\prime}|,|b|,|c^{\prime}|)^{2}\sqrt{|\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{\prime 2})|}\leq B\\}$

be the upper-bounding set appearing in Lemma 3.6. For this set, we split it up
into different pieces, as follows. Define

$S_{x}=\\{(a^{\prime},b,c^{\prime})\in S:\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{2})=x\\}\text{ and }S_{y}=\\{(a^{\prime},b,c^{\prime})\in
S:\operatorname{sq}(a^{\prime 2}+b^{2}-c^{2})=y\\}.$

We have the following bounds on $S_{x}$’s and $S_{y}$’s, all of which are
conditioned on GRH. The proof of each of the following three proposition will
be its own section. Together, these bounds will be more than enough to give
our upper bound on $S$. In particular, we do not need the full power of these
propositions.

######  Proposition 3.8.

Assuming GRH, for all $\epsilon>0$,

$\sum_{\begin{subarray}{c}2\leq x\leq B^{2/3-\epsilon}\\\ x\text{
squarefree}\end{subarray}}|S_{x}|=O_{\epsilon}(B\log B).$

This is done in Section 4.

######  Proposition 3.9.

Assuming GRH, for all $\epsilon>0$,

$\sum_{\begin{subarray}{c}-1\geq x\geq-B^{2/5-\epsilon}\\\ x\text{
squarefree}\end{subarray}}|S_{x}|=O_{\epsilon}(B\log B).$

This is done in Section 5.

######  Proposition 3.10.

Assuming GRH, for all $\epsilon>0$,

$\sum_{1\leq y\leq B^{5/19-\epsilon}}|S_{y}|=O_{\epsilon}(B\log B).$

This is done in Section 6.

With these propositions, we may prove the upper bound. These three
propositions give us bounds on $|S_{x}|$ for $|x|\leq B^{2/5-\epsilon}$ and
$|S_{y}|$ for $|y|\leq B^{5/19-\epsilon}$. Thus, it suffices to show

$S\subset\bigcup_{|x|\leq B^{2/5-\epsilon}}S_{x}\cup\bigcup_{y\leq
B^{5/19-\epsilon}}S_{y}$

for some small $\epsilon$. Indeed, let $(a^{\prime},b,c^{\prime})$ be an
element of $S$, let $x=\operatorname{sqf}(a^{\prime 2}+b^{2}-c^{\prime 2})$,
and let $y=\operatorname{sq}(a^{\prime 2}+b^{2}-c^{\prime 2})$. Suppose
$|x|\geq B^{2/5-\epsilon}$. Then, as $a^{\prime 2}+b^{2}-c^{\prime 2}=xy^{2}$
and $\max(|a|,|b|,|c|)^{2}\sqrt{|x|}\leq B$, we see that
$(xy^{2})\sqrt{|x|}\leq B$. Thus,
$y\leq\frac{B}{|x|^{3/2}}\leq\frac{B^{1/2}}{B^{3/10-3/2\epsilon}}=B^{1/5+3/2\epsilon}$.
After choosing an $\epsilon$ so that $1/5+3/2\epsilon\leq 5/19-\epsilon$, we
are done with the upper bound.

For the lower bound, define

$T:=\\{(a,b,c):\gcd(a,b)=1,\max(|a|,|b|,|c|)^{2}\sqrt{x}\leq
B,a^{2}+b^{2}\equiv 5\mod 8,$ $\operatorname{sqf}(a^{2}+b^{2}-c^{2})\equiv
b\equiv 0\mod 2\\}$

to be the lower-bounding set in Lemma 3.7. We prove $|T|\gg B\log B$ in
Proposition 7.5 in Section 7.

∎

The combination of these three theorems show that the diagonal
$\Delta\subset\operatorname{Sym}^{2}{\mathbb{P}}^{1}$ is an “accumulating
substack.” Indeed, on this subvariety, the asymptotic of the point counts are
on the order of $B^{2}$, while the asymptotic of the point counts off the
diagonal are on the order of $B\log B$.

We conclude this section with the proof of the two technical Lemmas 3.6 and
3.7.

###### Proof of Lemma 3.6.

We wish to show

$|\\{(a,b,c)\in{\mathbb{Z}}:a>0,\gcd(a,b,c)=1,\max(|a|,|b|,|c|)^{2}\sqrt{|\operatorname{sqf}(b^{2}-4ac)|}\leq
B,\operatorname{sqf}(b^{2}-4ac)\notin\\{0,1\\}\\}|$

is asymptotically upper bounded by

$|\\{(a^{\prime},b,c^{\prime}):\operatorname{sqf}(a^{\prime 2}+b^{2}-c^{\prime
2})\notin\\{0,1\\},\max(|a^{\prime}|,|b|,|c^{\prime}|)^{2}\sqrt{|\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{\prime 2})|}\leq B\\}|.$

For the upper bound, we may forget the conditions $a>0$ and $\gcd(a,b,c)=1$.
Also, we may make a linear change of variables
$a=\frac{c^{\prime}+a^{\prime}}{2}$, $c=\frac{c^{\prime}-a^{\prime}}{2}$, with
an inverse change of variables of $a^{\prime}=a-c$, $c^{\prime}=a+c$. Then,
$b^{2}-4ac=a^{\prime 2}+b^{2}-c^{\prime 2}$. So there is a bijection between

$\\{(a,b,c):\max(|a|,|b|,|c|)^{2}\sqrt{|\operatorname{sqf}(b^{2}-4ac)|}\leq
B\\}$

and

$\\{(a^{\prime},b,c^{\prime})\in{\mathbb{Z}}:\max(|\frac{c^{\prime}+a^{\prime}}{2}|,|b|,|\frac{c^{\prime}-a^{\prime}}{2}|)^{2}\sqrt{|\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{\prime 2})|}\leq B,a^{\prime}\equiv c^{\prime}\mod 2\\}.$

For an upper bound, we may drop the conditions $a^{\prime}\equiv
c^{\prime}\mod 2$. Furthermore,

$|\\{(a^{\prime},b,c^{\prime}):\operatorname{sqf}(a^{\prime 2}+b^{2}-c^{\prime
2})\notin\\{0,1\\},\max(|a^{\prime}|,|b|,|c^{\prime}|)^{2}\sqrt{|\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{\prime 2})|}\leq B\\}|.$
$\displaystyle\max(|a^{\prime}|,|b|,|c^{\prime}|)$
$\displaystyle=\max(|a-c|,|b|,|a+c|)$ $\displaystyle\leq 2\max(|a|,|b|,|c|)$
$\displaystyle=2\max(|\frac{a^{\prime}+c^{\prime}}{2}|,|b|,|\frac{a^{\prime}-c^{\prime}}{2}|)$

Thus, we have that

$|\\{(a,b,c)\in{\mathbb{Z}}:a>0,\gcd(a,b,c)=1,\max(|a|,|b|,|c|)^{2}\sqrt{|\operatorname{sqf}(b^{2}-4ac)|}\leq
B,\operatorname{sqf}(b^{2}-4ac)\notin\\{0,1\\}\\}|$

is bounded by

$|\\{(a^{\prime},b,c^{\prime}):\operatorname{sqf}(a^{\prime 2}+b^{2}-c^{\prime
2})\notin\\{0,1\\},\max(|a^{\prime}|,|b|,|c^{\prime}|)^{2}\sqrt{|\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{\prime 2})|}\leq 2B\\}|.$

Since we’re only looking for an asymptotic upper bound, we may remove the $2$
in front of the $B$. ∎

###### Proof of Lemma 3.7.

We will show that

$\\{(a^{\prime},b^{\prime},c^{\prime}):\gcd(a^{\prime},b^{\prime})=1,\max(|a^{\prime}|,|b^{\prime}|,|c^{\prime}|)^{2}\sqrt{\operatorname{sqf}(a^{\prime
2}+b^{\prime 2}-c^{\prime 2})}\leq B,a^{\prime 2}+b^{\prime 2}\equiv 5\mod 8,$
$\operatorname{sqf}(a^{\prime 2}+b^{\prime 2}-c^{\prime 2})\equiv
b^{\prime}\equiv 0\mod 2,\operatorname{sqf}(a^{\prime 2}+b^{\prime
2}-c^{\prime 2})\geq 2\\}$

injects into

$\\{(a,b,c)\in{\mathbb{Z}}:a>0,\gcd(a,b,c)=1,\max(|a|,|b|,|c|)^{2}\sqrt{|\operatorname{sqf}(b^{2}-4ac)|}\leq
B,\operatorname{sqf}(b^{2}-4ac)\notin\\{0,1\\}\\}$

via the map

$(a^{\prime},b^{\prime},c^{\prime})\to(\frac{a^{\prime}-c^{\prime}}{2},\frac{b^{\prime}}{2},\frac{a^{\prime}+c^{\prime}}{2}).$

Assuming the map is well defined, the injection follows as this is a linear
map which is even injective over the reals. So, we just need to show well-
definedness.

We first check the coprime condition. Since $a^{\prime 2}+b^{\prime 2}\equiv
5\mod 8$, and $b^{\prime}$ is even, we must have that $a^{\prime}$ is odd.
Thus, $a^{\prime 2}\equiv 1\mod 8$, and so $\frac{b^{\prime}}{2}$ must be odd,
otherwise $b^{\prime 2}\equiv 0\mod 8$ so that $a^{\prime 2}+b^{\prime
2}\not\equiv 5\mod 8$. We also have that by similar reasoning, $c^{\prime}$
must be odd. So, we have that $a^{\prime},c^{\prime}$ are odd, and
$b^{\prime}$ is even but $\frac{b^{\prime}}{2}$ is odd. Thus,
$\frac{a^{\prime}-c^{\prime}}{2},\frac{b^{\prime}}{2},\frac{a^{\prime}+c^{\prime}}{2}$
are all integers. Suppose now that these integers are not coprime. Then, there
is some prime $p$ dividing all of them. Now since
$p|\frac{a^{\prime}-c^{\prime}}{2}$ and $\frac{a^{\prime}+c^{\prime}}{2}$, we
have $p|a^{\prime}$. Also, since $p|\frac{b^{\prime}}{2}$, $p|b^{\prime}$. But
this contradicts the assumption that $a^{\prime},b^{\prime}$ are coprime.

Now we only need to check the height bound. We have

$\max\left(\left\lvert\frac{a^{\prime}-c^{\prime}}{2}\right\lvert,\left\lvert\frac{b^{\prime}}{2}\right\lvert,\left\lvert\frac{a^{\prime}+c^{\prime}}{2}\right\lvert\right)\leq\max(|a^{\prime}|,|b^{\prime}|,|c^{\prime}|)$

and

$\frac{1}{4}(a^{\prime 2}+b^{\prime 2}-c^{\prime
2})=(\frac{b^{\prime}}{2})^{2}-4(\frac{a^{\prime}-c^{\prime}}{2})(\frac{a^{\prime}+c^{\prime}}{2}),$

so that

$|\operatorname{sqf}(a^{\prime 2}+b^{\prime 2}-c^{\prime
2})|=|\operatorname{sqf}((\frac{b^{\prime}}{2})^{2}-4(\frac{a^{\prime}-c^{\prime}}{2})(\frac{a^{\prime}+c^{\prime}}{2}))|.$

Thus,

$\displaystyle B$
$\displaystyle\geq\max(|a^{\prime}|,|b^{\prime}|,|c^{\prime}|)^{2}\sqrt{|\operatorname{sqf}(a^{\prime
2}+b^{\prime 2}-c^{\prime 2})|}$
$\displaystyle\geq\max\left(\left\lvert\frac{a^{\prime}-c^{\prime}}{2}\right\lvert,\left\lvert\frac{b^{\prime}}{2}\right\lvert,\left\lvert\frac{a^{\prime}+c^{\prime}}{2}\right\lvert\right)^{2}\sqrt{|\operatorname{sqf}((\frac{b^{\prime}}{2})^{2}-4(\frac{a^{\prime}-c^{\prime}}{2})(\frac{a^{\prime}+c^{\prime}}{2}))|}$
$\displaystyle=\max(|a|,|b|,|c|)^{2}\sqrt{|\operatorname{sqf}(b^{2}-4ac)|}$

∎

##  4 Estimate of $|S_{x}|$ for $1\leq x\leq B^{2/3-\epsilon}$

In this section, we prove Proposition 3.8. Let $F(n)$ be the number of ways
$n$ can be written as a sum of two positive squares, and let

$\displaystyle G_{x}(n)$ $\displaystyle=\\#\\{\text{ideals
}I\subset{\mathcal{O}}_{{\mathbb{Q}}[\sqrt{-x}]}:N(I)=n,I\text{ is
principal}\\}$
$\displaystyle=\begin{cases}\frac{1}{\omega_{x}}\\#\\{(c,y)\in{\mathbb{Z}}^{2}:c^{2}+xy^{2}=n\\}&x\equiv
2,3\mod 4\\\
\frac{1}{\omega_{x}}\\#\\{(c,y)\in(\frac{1}{2}{\mathbb{Z}})^{2}:c^{2}+xy^{2}=n\\}&x\equiv
1\mod 4\end{cases}$

We may identify $S_{x}$ with

$\\{(a,b,c,y):\max(|a|,|b|,|c|)^{2}\sqrt{x}\leq
B,a^{2}+b^{2}=c^{2}+xy^{2}\\},$

by just letting $y=\operatorname{sq}(a^{2}+b^{2}-c^{2})$. Since $x$ is
positive, we have $\max(|a|,|b|,|c|)^{2}\leq B/\sqrt{x}$, and so $a^{2}+b^{2}$
is at most $2B/\sqrt{x}$. Then, for a fixed positive $x$, we have $|S_{x}|\leq
4\omega_{x}\sum_{n=1}^{2B/\sqrt{x}}F(n)G_{x}(n)$. $F(n)$ is a multiplicative
function, and $G_{x}(n)$ is a sum of multiplicative function indexed by the
elements of the class group, and so we may use the theory of $L$-functions and
Tauberian theorems to get good estimates on $|S_{x}|$.

Let

$L_{x}(s)=\sum_{n=1}^{\infty}\frac{F(n)G_{x}(n)}{n^{s}}.$

With $L_{x}(s)$, we will proceed with the following steps.

  1. 1.

We show that $L_{x}(s)$ can be meromorphically continued to $\Re(s)>1/2$, with
a simple pole at $s=1$.

  2. 2.

We find the residue of $L_{x}(s)$ at $s=1$.

  3. 3.

We use the Wiener-Ikehara Tauberian theorem as in Theorem 8.1 to obtain an
estimate on the sum of the coefficients on $L_{x}(s)$, with an acceptable
error term.

We may express $L_{x}(s)$ as a sum of $L$-functions with Euler product. Let
$\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}$ be the characters on
the class group of ${\mathbb{Q}}[\sqrt{-x}]$. Let
$\chi\in\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}$. Consider the
following $L$-functions. Let

$L_{0}(\chi,s)=\sum_{n=1}^{\infty}\frac{F(n)\sum_{\text{ideals
}I\subset{\mathcal{O}}_{{\mathbb{Q}}[\sqrt{-x}]},N(I)=n}\chi(I)}{n^{s}}.$

Thus,

$L_{x}(s)=\frac{1}{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])|}\sum_{\chi\in\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}}L_{0}(\chi,s).$

We first make the following definitions.

$\displaystyle P_{1,1}=\\{\text{primes }p|p\text{ splits in
}{\mathbb{Q}}[i]\text{ and }{\mathbb{Q}}[\sqrt{-x}]\\}$ $\displaystyle
P_{1,0}=\\{\text{primes }p|p\text{ splits in }{\mathbb{Q}}[i]\text{ and is
inert in }{\mathbb{Q}}[\sqrt{-x}]\\}$ $\displaystyle P_{0,1}=\\{\text{primes
}p|p\text{ is inert in }{\mathbb{Q}}[i]\text{ and splits in
}{\mathbb{Q}}[\sqrt{-x}]\\}$ $\displaystyle P_{0,0}=\\{\text{primes }p|p\text{
is inert in }{\mathbb{Q}}[i]\text{ and }{\mathbb{Q}}[\sqrt{-x}]\\}$
$\displaystyle P_{1,ram}=\\{\text{primes }p|p\text{ splits in
}{\mathbb{Q}}[i]\text{ and ramifies in }{\mathbb{Q}}[\sqrt{-x}]\\}$
$\displaystyle P_{0,ram}=\\{\text{primes }p|p\text{ is inert in
}{\mathbb{Q}}[i]\text{ and ramifies in }{\mathbb{Q}}[\sqrt{-x}]\\}$

Also, we define

$Z_{2,x,\chi}(s)=\begin{cases}1+\frac{\chi(\pi_{2})}{2^{s}}+\frac{\chi(\bar{\pi}_{2})}{2^{s}}+\frac{\chi(\pi_{2}^{2})}{2^{2s}}+\frac{\chi(\pi_{2}\bar{\pi}_{2})}{2^{2s}}+\frac{\chi(\bar{\pi}_{2}^{2})}{2^{2s}}+\dots&2\text{
splits as }\pi_{2}\bar{\pi}_{2}\text{ in }{\mathbb{Q}}[\sqrt{-x}]\\\
1+\frac{\chi(\pi_{2})}{2^{s}}+\frac{\chi(\pi_{2}^{2})}{2^{2s}}+\dots&2\text{
ramifies in }{\mathbb{Q}}[\sqrt{-x}]\\\
1+\frac{\chi(2)}{2^{2s}}+\frac{\chi(4)}{2^{4s}}+\dots&2\text{ is inert in
}{\mathbb{Q}}[\sqrt{-x}]\end{cases}$

Then, we have the Euler product

$\displaystyle L_{0}(\chi,s)$ $\displaystyle=Z_{2,x,\chi}(s)\prod_{p\in
P_{1,1}}\left(1+\frac{2\chi(\pi)}{p^{s}}+\frac{2\chi(\bar{\pi})}{p^{s}}+\frac{3\chi(\pi^{2})}{p^{2s}}+\frac{3\chi(\pi\bar{\pi})}{p^{2s}}+\frac{3\chi(\bar{\pi}^{2})}{p^{2s}}+\dots\right)$
$\displaystyle\prod_{p\in
P_{1,0}}\left(1+\frac{3\chi(p)}{p^{2s}}+\frac{5\chi(p^{2})}{p^{4s}}+\dots\right)\prod_{p\in
P_{0,1}}\left(1+\frac{\chi(\pi^{2})}{p^{2s}}+\frac{\chi(\pi\bar{\pi})}{p^{2s}}+\frac{\chi(\bar{\pi})^{2}}{p^{2s}}+\dots\right)$
$\displaystyle\prod_{p\in
P_{0,0}}\left(1+\frac{\chi(p)}{p^{2s}}+\frac{\chi(p^{2})}{p^{4s}}+\dots\right)\prod_{p\in
P_{1,ram}}\left(1+\frac{2\chi(\pi)}{p^{s}}+\frac{3\chi(\pi^{2})}{p^{2s}}+\dots\right)$
$\displaystyle\prod_{p\in
P_{0,ram}}\left(1+\frac{\chi(p)}{p^{2s}}+\frac{\chi(p^{2})}{p^{4s}}+\dots\right).$
(4.1)

Let $\chi_{x}$ be the character associated to the Jacobi Symbol
$\chi_{x}(n)=\left(\frac{x}{n}\right)$. Having obtained that $L_{x}(s)$ is a
sum of Euler products, we get

######  Lemma 4.1.

$L_{x}(s)$ may be meromorphically continued to $\Re(s)>1/2$, with a simple
pole at $s=1$ of residue
$\frac{1}{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])|}\operatorname{Res}_{s=1}L_{0}(\chi_{\operatorname{triv}},s)$.

###### Proof.

From the definition of $L_{x}(s)$, it suffices to meromorphically continue
each $L_{0}(\chi,s)$. From the product definition of $L_{0}(\chi,s)$ as in
Equation 4, we see that besides the product

$\prod_{p\in
P_{1,1}}\left(1+\frac{2\chi(\pi)}{p^{s}}+\frac{2\chi(\bar{\pi})}{p^{s}}+\frac{3\chi(\pi^{2})}{p^{2s}}+\frac{3\chi(\pi\bar{\pi})}{p^{2s}}+\frac{3\chi(\bar{\pi}^{2})}{p^{2s}}+\dots\right),$

everything else converges absolutely for $\Re(s)>1/2$. So, it suffices to
continue this product. We may rewrite this product as

$\prod_{\pi,\chi_{-1}(N(\pi))=1}(1+\frac{\chi(\pi)}{N(\pi)^{s}})^{2}$

up to products of the form

$\prod_{p}(1+\frac{a_{p,2}}{p^{2s}}+\frac{a_{p,3}}{p^{3s}}+\dots),$

such that $f(i)=\max_{p}|a_{p,i}|$ is polynomially bounded independent of $x$.
That is, $f(i)\leq P(i)$ for some polynomial $P$, not dependent on $x$. This
final product is then again equal to $L(\chi,s)L(\chi\chi_{-1},s)$ (where
these are Hecke L-functions) up to products of the form

$\prod_{p}(1+\frac{a_{p,2}}{p^{2s}}+\frac{a_{p,3}}{p^{3s}}+\dots)$

with coefficients of bounded growth rate. Now $L(\chi,s)L(\chi\chi_{-1},s)$ is
holomorphic for $\chi\neq\chi_{\operatorname{triv}}$, and meromorphic with a
simple pole at $s=1$ for $\chi=\chi_{\operatorname{triv}}$. Since the
intermediate products of the form

$\prod_{p}(1+\frac{a_{p,2}}{p^{2s}}+\frac{a_{p,3}}{p^{3s}}+\dots)$

are absolutely convergent for $\Re(s)>1/2$, we have that $L_{0}(\chi,s)$ is
holomorphic on $\Re(s)>1/2$ for $\chi\neq\chi_{\operatorname{triv}}$ and
meromorphic with a simple pole at $s=1$ for $\chi=\chi_{\operatorname{triv}}$.
Thus, as
$L_{x}(s)=\frac{1}{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])|}\sum_{\chi}L_{0}(\chi,s)$,
we have that $L_{x}(s)$ is meromorphic with a simple pole only at $s=1$ of
residue $\operatorname{Res}_{s=1}L_{0}(\chi_{\operatorname{triv}},s)$. ∎

######  Lemma 4.2.

$\operatorname{Res}_{s=1}L_{x}(s)=O(\frac{L(\chi_{x},1)\prod_{p|x}(1+p^{-1})^{2}}{\sqrt{x}})$

###### Proof.

By Lemma 4.1, we restrict our attention to
$\operatorname{Res}_{s=1}L_{0}(\chi_{\operatorname{triv}},s)$.

$\displaystyle L_{0}(\chi_{\operatorname{triv}},s)$
$\displaystyle=Z_{2,x,\chi_{0}}(s)\prod_{p\in
P_{1,1}}\left(1+\frac{4}{p^{s}}+\frac{9}{p^{2s}}+\dots\right)\prod_{p\in
P_{1,0}}\left(1+\frac{3}{p^{2s}}+\frac{5}{p^{4s}}+\dots\right)$
$\displaystyle\prod_{p\in
P_{0,1}}\left(1+\frac{3}{p^{2s}}+\frac{5}{p^{4s}}+\dots\right)\prod_{p\in
P_{0,0}}\left(1+\frac{1}{p^{2s}}+\frac{1}{p^{4s}}+\dots\right)$
$\displaystyle\prod_{p\in
P_{1,ram}}\left(1+\frac{2}{p^{s}}+\frac{3}{p^{2s}}+\dots\right)\prod_{p\in
P_{0,ram}}\left(1+\frac{1}{p^{s}}+\frac{1}{p^{2s}}+\dots\right).$

First, we may bound $Z_{2,x,\chi_{0}}(s)$ independently of $x$ from above by
$(1-2^{-1})^{2}=4$. We may rewrite the rest of the product as

$\prod_{p\in P_{1,1}}(1-p^{-s})^{-4}(1-p^{-2s})\prod_{p\in P_{1,0}\cup
P_{0,1}}(1-p^{-2s})^{-2}(1+p^{-2s})\prod_{p\in P_{0,0}}(1-p^{-2s})^{-1}$
$\prod_{p\in P_{1,ram}}(1-p^{-s})^{-2}\prod_{p\in P_{0,ram}}(1-p^{-2s})^{-1}.$
(4.2)

Then, one may check local factor by local factor that

$\zeta(s)L(\chi_{-1},s)L(\chi_{x},s)L(\chi_{-1}\chi_{x},s)\prod_{p\in
P_{1,1}\cup P_{0,0}}(1-p^{-2s})\prod_{p\in P_{1,0}\cup P_{0,1}}(1+p^{-2s})$
$\prod_{p\in P_{1,ram}}(1-p^{-s})^{-2}\prod_{p\in P_{0,ram}}(1-p^{-2s})^{-1}$

is equal to the product in Equation 4.2. Now at $s=1$, there’s a pole with
residue which is bounded above by

$O(L(\chi_{x},1)L(\chi_{-1}\chi_{x},1)\prod_{p|x}(1+p^{-1})^{2}).$

By the class number formula,

$L(\chi_{-1}\chi_{x},1)=\frac{\pi|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])|}{\sqrt{x}}$

for all $0<x\neq 3$, and for $x=3$, it’s just $\frac{1}{3}$ of the above. So,
the residue of $L(\chi_{\operatorname{triv}},s)$ at $s=1$ is bounded above by

$O(\frac{L(\chi_{x},1)\prod_{p|x}(1+p^{-1})^{2}|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])|}{\sqrt{x}}).$

Thus, the residue of $L_{x}(s)$ is

$O(\frac{L(\chi_{x},1)\prod_{p|x}(1+p^{-1})^{2}}{\sqrt{x}}).$

∎

######  Proposition 4.3.

Assuming GRH, for all $\epsilon>0$,
$\sum_{n=1}^{X}F(n)G_{x}(n)=X\operatorname{Res}_{s=1}L_{x}(s)+O_{\epsilon}(X^{1/2+\epsilon}x^{\epsilon})$.

###### Proof.

We use the Wiener-Ikehara Tauberian theorem. We need to bound $L_{x}(s)$ in
the range $1/2+\epsilon<\Re(s)\leq 1$. Now as in the proof of Lemma 4.1, we
have that $L_{0}(\chi,s)$ is equal to $L(\chi,s)L(\chi\chi_{-1},s)$ up to
products of following forms:

  1. 1.

$\prod_{p}(1+\frac{a_{p,2}}{p^{2s}}+\frac{a_{p,3}}{p^{3s}}+\dots)$, where
$f(i)=\max_{p}|a_{p,i}|$ satisfies $f(i)\leq P(i)$ for some polynomial $P$
independent of $x$.

  2. 2.

local factors of the primes ramified in either ${\mathbb{Q}}[i]$ or
${\mathbb{Q}}[\sqrt{-x}]$.

Now, for $\Re(s)=1/2+\epsilon$,

$\left|\prod_{p}(1+\frac{a_{p,2}}{p^{2s}}+\frac{a_{p,3}}{p^{3s}}+\dots)\right|\leq\prod_{p}(1+\frac{P(2)}{p^{1+2\epsilon}}+\frac{P(3)}{p^{3/2+3\epsilon}}+\dots)=O_{\epsilon}(1).$

For the local factors of the ramified primes, in the case where $p\in
P_{1,ram}$, for example, we have

$|(1+\frac{2\chi(\pi)}{p^{s}}+\frac{3\chi(\pi^{2})}{p^{2s}}+\dots)|=|(1-\chi(\pi)p^{-s})|^{-2}\leq(1-p^{-1/2})^{-2}\leq
12.$

Thus, the contribution coming from the product over these local factors is
bounded by $12^{\omega(x)+1}=O(x^{\epsilon})$. Thus, for
$\Re(s)=1/2+\epsilon$,
$|L_{0}(\chi,s)|=O_{\epsilon}(x^{\epsilon}|L(\chi,s)L(\chi\chi_{-1},s)|)$. Now
$L(\chi,s)$ is an $L$-function with analytic conductor $O(x)$. So, by GRH, we
have that for $s=1/2+it$, $|L(\chi,s)|=O_{\delta}((xt)^{\delta})$ for any
$\delta>0$. Thus, by the Phragmén-Lindelöf Principle, we also have that
$|L(\chi,s)|=O_{\delta,\epsilon}((xt)^{\delta})$ for $s=1/2+\epsilon+it$. The
same holds for $|L(\chi\chi_{-1},s)|$. Thus, we obtain the bound

$|L_{0}(\chi,s)|=O_{\delta,\epsilon}(x^{\epsilon}(xt)^{\delta})$ (4.3)

for $s=1/2+\epsilon+it$ and any $\epsilon>0$. Since $L_{x}(s)$ is an average
of $L_{0}(\chi,s)$ as $\chi$ varies over
$\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}$, we have the same bound
for $|L_{x}(s)|$.

Now we are in the hypothesis of the Wiener-Ikehara Tauberian theorem as in
Theorem 8.1 with $\kappa=1$ and $r$ the implied constant in Equation 4.3. So,
combining with Lemmas 4.2 and 4.1, we get that the sum of the coefficients of
$L_{x}(s)$ up to $X$ is

$X\operatorname{Res}_{s=1}L_{x}(s)+O_{\epsilon,\delta}(X^{1/2+\epsilon}x^{\delta+\epsilon}).$

We are done after choosing $\delta=\epsilon$. ∎

######  Corollary 4.4.

Assuming GRH, for all $\epsilon>0$,
$|S_{x}|=O_{\epsilon}(B\frac{L(\chi_{x},1)\prod_{p|x}(1+p^{-1})^{2}}{x}+B^{1/2+\epsilon}x^{-1/4+\epsilon})$

###### Proof.

Combine Lemma 4.2 and Proposition 4.3, and apply it to the case where
$X=\frac{B}{\sqrt{x}}$. ∎

To conclude, we just need to sum over $x\leq B^{2/3-\epsilon}$.

###### Proof of Proposition 3.8.

By Corollary 4.4, we just need to upper bound

$\sum_{x\geq 2,\text{
squarefree}}^{B^{2/3-\epsilon}}O_{\delta}\left(B\frac{L(\chi_{x},1)\prod_{p|x}(1+p^{-1})^{2}}{x}+B^{1/2+\delta}x^{-1/4+\delta}\right)$

for some small $\delta$ to be chosen later. Applying the sum, we obtain that
the error term is
$B^{1/2+\delta}B^{(2/3-\epsilon)(3/4+\delta)}=B^{1+\frac{5}{3}\delta-\frac{3}{4}\epsilon-\epsilon\delta}$.
So, making the choice of $\delta=\frac{9}{20}\epsilon$, we get an error term
of $O(B^{1-\epsilon\delta})=O(B)$, as desired. Now we may focus on our first
term.

We wish to estimate

$\sum_{x\geq 2,\text{
squarefree}}^{B^{2/3-\epsilon}}B\frac{L(\chi_{x},1)\prod_{p|x}(1+p^{-1})^{2}}{x}.$

We have
$\prod_{p|x}(1+p^{-1})^{2}=O(\prod_{p|x}(1+2p^{-1}))=O(\sum_{d|x}\tau(d)/d)$.
So, it suffices to bound

$\sum_{x\geq 2,\text{
squarefree}}^{B^{2/3-\epsilon}}\frac{L(\chi_{x},1)\sum_{d|x}\tau(d)/d}{x}$

by $O(\log B)$. We have

$\displaystyle\sum_{x\geq 2,\text{
squarefree}}^{B^{2/3-\epsilon}}\frac{L(\chi_{x},1)\sum_{d|x}\tau(d)/d}{x}$
$\displaystyle=\sum_{d=1}^{B^{2/3-\epsilon}}\frac{\tau(d)}{d}\sum_{x^{\prime}\geq
2,dx^{\prime}\text{
squarefree}}^{B^{2/3-\epsilon}d^{-1}}\frac{L(\chi_{dx^{\prime}},1)}{dx^{\prime}}$
$\displaystyle=\sum_{d=1}^{B^{2/3-\epsilon}}\frac{\tau(d)}{d^{2}}\sum_{x^{\prime}\geq
2}^{B^{2/3-\epsilon}d^{-1}}\frac{|\mu(dx^{\prime})|L(\chi_{dx^{\prime}},1)}{x^{\prime}}$
$\displaystyle=\sum_{d=1}^{B^{2/3-\epsilon}}\frac{\tau(d)|\mu(d)|}{d^{2}}\sum_{x^{\prime}\geq
2,\gcd(d,x^{\prime})=1}^{B^{2/3-\epsilon}d^{-1}}\frac{|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)}{x^{\prime}}$
$\displaystyle=\sum_{d=1}^{B^{2/3-\epsilon}}\frac{\tau(d)|\mu(d)|}{d^{2}}\sum_{x^{\prime}\geq
2}^{B^{2/3-\epsilon}d^{-1}}\frac{|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)}{x^{\prime}},$

where the last inequality used the fact that $L(\chi_{dx^{\prime}},1)\geq 0$
for all $d,x^{\prime}$.

We will record the bound of the inner sum in a lemma, to be used later as
well.

######  Lemma 4.5.

$\sum_{x^{\prime}\geq
2}^{X}\frac{|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)}{x^{\prime}}=O(\log
X+d^{1/2}\log(d))$

###### Proof.

We may use summation by parts to get

$\sum_{x^{\prime}\geq
2}^{X}\frac{|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)}{x^{\prime}}=O\left(\sum_{k=1}^{X}\frac{\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)}{k^{2}}\right).$

For the inner sum, we have

$\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)=\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\sum_{n=1}^{\infty}\frac{\left(\frac{dx^{\prime}}{n}\right)}{n}.$

Now, we will split the infinite sum over $n$ into two parts. The first part
will be

$\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\sum_{n=k}^{\infty}\frac{\left(\frac{dx^{\prime}}{n}\right)}{n}=\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|O(\frac{\sqrt{dx^{\prime}}\log(dx^{\prime})}{k})=O(d^{1/2}k^{1/2}\log(dk))$
(4.4)

where the first equality is obtained through summation by parts and Polya-
Vinogradov. So, we are left with the other part,

$\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\sum_{n=1}^{k}\frac{(\frac{dx^{\prime}}{n})}{n}.$

Here, we exchange summation and consider

$\sum_{n=1}^{k}\frac{1}{n}\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\left(\frac{dx^{\prime}}{n}\right)=\sum_{n=1}^{k}\frac{1}{n}\left(\frac{d}{n}\right)\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\left(\frac{x^{\prime}}{n}\right).$
(4.5)

We separate this sum into two cases, depending on whether $n$ is a square. So,
we separate Equation 4.5 into

$\sum_{n=1,n\text{ is a
square}}^{k}\frac{1}{n}\left(\frac{d}{n}\right)\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\left(\frac{x^{\prime}}{n}\right)+\sum_{n=1,n\text{
is not a
square}}^{k}\frac{1}{n}\left(\frac{d}{n}\right)\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\left(\frac{x^{\prime}}{n}\right)$

First we deal with the case where $n$ is a square, where we are happy to use
the trivial estimate
$|\left(\frac{d}{n}\right)|=|\left(\frac{x^{\prime}}{n}\right)|=1$, and we
obtain

$\sum_{n=1,n\text{ is a
square}}^{k}\frac{1}{n}\left(\frac{d}{n}\right)\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\left(\frac{x^{\prime}}{n}\right)\leq\sum_{n=1,n\text{
is a
square}}^{k}\frac{k}{n}=O(\sum_{n^{\prime}=1}^{\sqrt{k}}\frac{k}{n^{\prime
2}})=O(k).$

Now we turn to the case where $n$ is not a square and estimate

$\sum_{n=1,n\text{ is not a
square}}^{k}\frac{1}{n}\left(\frac{d}{n}\right)\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\left(\frac{x^{\prime}}{n}\right).$

Using the fact that $|\mu(x^{\prime})|=\sum_{l^{2}|x^{\prime}}\mu(l)$, we
obtain

$\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\left(\frac{x^{\prime}}{n}\right)=\sum_{x^{\prime}=1}^{k}\sum_{l^{2}|x^{\prime}}\mu(l)\left(\frac{x^{\prime}}{n}\right)=\sum_{l=1}^{\sqrt{k}}\mu(l)\sum_{x^{\prime\prime}=1}^{k/l^{2}}\left(\frac{x^{\prime\prime}}{n}\right),$

where in the last equality, we made the substitution
$x^{\prime\prime}=l^{2}x^{\prime}$. By Polya-Vinogradov, if $n$ is not a
square,
$\left\lvert\sum_{x^{\prime}=1}^{k/l^{2}}\left(\frac{x^{\prime}}{n}\right)\right\lvert=O(\sqrt{n}\log
n)$, and a trivial estimate gives us that it is $O(k/l^{2})$. Hence,

$\left\lvert\sum_{x^{\prime}=1}^{k/l^{2}}\left(\frac{x^{\prime}}{n}\right)\right\lvert=O(\min(\sqrt{n}\log
n,k/l^{2})).$

Thus,

$\displaystyle\sum_{l=1}^{\sqrt{k}}\mu(l)\sum_{x^{\prime\prime}=1}^{k/l^{2}}\left(\frac{x^{\prime\prime}}{n}\right)$
$\displaystyle=O(\sum_{l=1}^{\sqrt{k}}\min(\sqrt{n}\log n,k/l^{2}))$
$\displaystyle=O\left(\sum_{l=1}^{\sqrt{k}/(\sqrt{n}\log
n))^{1/2}}\sqrt{n}\log n+\sum_{l=\sqrt{k}/(\sqrt{n}\log
n))^{1/2}}^{\sqrt{k}}k/l^{2}\right)$
$\displaystyle=O(k^{1/2}n^{1/4}\log^{1/2}(n))$

when $n$ is not a square. Using this estimate, we have that

$\displaystyle\sum_{n=1,n\text{ is not a
square}}^{k}\frac{1}{n}\left(\frac{d}{n}\right)\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|\left(\frac{x^{\prime}}{n}\right)$
$\displaystyle=O\left(\sum_{n=1,n\text{ is not a
square}}^{k}\frac{k^{1/2}n^{1/4}\log^{1/2}(n)}{n}\right)$
$\displaystyle=O(k^{3/4}\log^{1/2}(k))$ $\displaystyle=O(k).$

Adding to Equation 4.4, we obtain

$\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)=O(k+(dk)^{1/2}\log(dk)).$

Finally, we sum over $k$. We have

$\displaystyle\sum_{k=1}^{X}\frac{\sum_{x^{\prime}=1}^{k}|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)}{k^{2}}$
$\displaystyle=\sum_{k=1}^{X}\frac{O(k+d^{1/2}k^{1/2}\log(dk))}{k^{2}}$
$\displaystyle=O(\log X+d^{1/2}\log(d)).$

∎

With the lemma, we have

$\sum_{x^{\prime}\geq
2}^{B^{2/3-\epsilon}d^{-1}}\frac{|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)}{x^{\prime}}=O(\log(B^{2/3-\epsilon}d^{-1}))+O(d^{1/2}\log(d)).$

Thus,

$\displaystyle\sum_{d=1}^{B^{2/3-\epsilon}}\frac{\tau(d)|\mu(d)|}{d^{2}}\sum_{x^{\prime}=1,(x^{\prime},d)=1}^{B^{2/3-\epsilon}d^{-1}}\frac{|\mu(x^{\prime})|L(\chi_{dx^{\prime}},1)}{x^{\prime}}$
$\displaystyle=\sum_{d=1}^{B^{2/3-\epsilon}}\frac{\tau(d)|\mu(d)|}{d^{2}}(O(\log(B^{2/3-\epsilon}d^{-1}))+O(d^{1/2}\log(d)))$
$\displaystyle=O(\log(B^{2/3-\epsilon})+O(1)$ $\displaystyle=O(\log(B)).$

∎

##  5 Estimate of $|S_{x}|$ for $-1\geq x\geq B^{2/5-\epsilon}$

In this section, we prove Proposition 3.9. Recall the definition

$S_{x}=\\{(a^{\prime},b,c^{\prime}):\operatorname{sqf}(a^{\prime
2}+b^{2}-c^{\prime 2})=x,\max(|a^{\prime}|,|b|,|c^{\prime}|)^{2}\sqrt{|x|}\leq
B\\}.$

We will introduce a new set $S_{x}^{\prime}$ which is easier to count and
satisfies $|S_{x}|\leq|S_{x}^{\prime}|$. We first write $a^{\prime
2}+b^{2}-c^{\prime 2}=xy^{2}$, for some $y$. Rearranging the terms, we get
$a^{\prime 2}-xy^{2}=c^{\prime 2}-b^{2}=(c^{\prime}-b)(c^{\prime}+b)$. Making
the linear change of variables $b^{\prime}=c^{\prime}-b$ and
$c^{\prime\prime}=c^{\prime}+b$, we have that $S_{x}$ is in bijection with
$\\{(a^{\prime},b^{\prime},c^{\prime\prime}):\operatorname{sqf}(a^{\prime
2}-b^{\prime}c^{\prime\prime})=x,\max(|a^{\prime}|,|\frac{c^{\prime\prime}-b^{\prime}}{2}|,|\frac{c^{\prime\prime}+b^{\prime}}{2}|)^{2}\sqrt{|x|}\leq
B,c^{\prime\prime}\equiv b^{\prime}\mod 2\\}$. For the sake of an upper bound,
we may forget the condition $c^{\prime\prime}\equiv b^{\prime}\mod 2$, and
also we have that

$\max(|a^{\prime}|,|b^{\prime}|,|c^{\prime\prime}|)=\max(|a^{\prime}|,|c^{\prime}-b|,|c^{\prime}+b|)\leq
2\max(|a^{\prime}|,|b|,|c^{\prime}|)=2\max(|a^{\prime}|,|\frac{c^{\prime\prime}-b^{\prime}}{2}|,|\frac{c^{\prime\prime}+b^{\prime}}{2}|).$

Hence, defining

$S_{x}^{\prime}:=\\{(a^{\prime},b^{\prime},c^{\prime\prime}):\operatorname{sqf}(a^{\prime
2}-b^{\prime}c^{\prime\prime})=x,\max(|a^{\prime}|,|b^{\prime}|,|c^{\prime\prime}|)^{2}\sqrt{|x|}\leq
B\\},$

we have that $|S_{x}|\leq|S_{x}^{\prime}|$, and so now it suffices to bound
$S_{x}^{\prime}$.

Note that by definition of $S_{x}^{\prime}$, any
$(a^{\prime},b^{\prime},c^{\prime\prime})\in S_{x}^{\prime}$ must satisfy that
$b^{\prime}c^{\prime\prime}\leq B/\sqrt{|x|}$. Now, writing $a^{\prime
2}-b^{\prime}c^{\prime\prime}=xy^{2}$, and rearranging, we get
$b^{\prime}c^{\prime\prime}=a^{\prime 2}-xy^{2}$. Now define
$\tau^{\prime}(n)$ to be the number of divisors $d$ of $n$ so that both $d$
and $n/d$ are bounded by $(B/\sqrt{|x|})^{1/2}$. Then,
$\tau^{\prime}(n)G_{-x}(n)$ is the number of solutions
$a^{\prime},b^{\prime},c^{\prime\prime},y$ to the equation
$b^{\prime}c^{\prime\prime}=a^{\prime 2}-xy^{2}=n$. So, for a fixed negative
$x$, we have
$|S_{x}^{\prime}|=\sum_{n=1}^{B/\sqrt{|x|}}\tau^{\prime}(n)G_{-x}(n)$.
However, $\tau^{\prime}$ is not a multiplicative function like $F(n)$, so we
will approach this summation slightly differently. Denote by
$\mathbbm{1}_{[1,(B/\sqrt{|x|})^{1/2}]}$ the characteristic function of the
interval $[1,(B/\sqrt{|x|})^{1/2}]$. Then, we have

$\displaystyle\sum_{n=1}^{B/\sqrt{|x|}}\tau^{\prime}(n)G_{-x}(n)$
$\displaystyle=\sum_{n=1}^{B/\sqrt{|x|}}G_{-x}(n)\sum_{d|n}\mathbbm{1}_{[1,(B/\sqrt{|x|})^{1/2}]}(d)\mathbbm{1}_{[1,(B/\sqrt{|x|})^{1/2}]}(n/d)$
$\displaystyle=\sum_{d=1}^{(B/\sqrt{|x|})^{1/2}}\sum_{n^{\prime}=1}^{(B/\sqrt{|x|})/d}G_{-x}(dn^{\prime})\mathbbm{1}_{[1,(B/\sqrt{|x|})^{1/2}]}(n^{\prime})$
$\displaystyle=\sum_{d=1}^{(B/\sqrt{|x|})^{1/2}}\sum_{n^{\prime}=1}^{(B/\sqrt{|x|})^{1/2}}G_{-x}(dn^{\prime}).$

Now we will use the theory of $L$-functions and Tauberian theorems to estimate
the inner sum, and subsequently the outer sum.

Let $x^{\prime}=-x$. We need to estimate

$\sum_{d=1}^{(B/\sqrt{x^{\prime}})^{1/2}}\sum_{n^{\prime}=1}^{(B/\sqrt{x^{\prime}})^{1/2}}G_{x^{\prime}}(dn^{\prime})$

as $x^{\prime}$ ranges between the squarefree numbers in the interval
$[2,B^{2/5-\epsilon}]$. Fixing $d$, we need to find an estimate on

$\sum_{n^{\prime}=1}^{(B/\sqrt{x^{\prime}})^{1/2}}G_{x^{\prime}}(dn^{\prime}).$

We do so by considering the $L$-function
$L_{x^{\prime},d}(s)=\sum_{n=1}^{\infty}\frac{a_{x^{\prime},d,n}}{n^{s}}$,
where

$a_{x^{\prime},d,n}=\begin{cases}|\\{\text{ideals
}I\subset{\mathcal{O}}_{{\mathbb{Q}}[\sqrt{-x^{\prime}}]}:N(I)=n,I\text{ is
principal}\\}|&d|n\\\ 0&\text{ otherwise}\end{cases},$

so that

$\sum_{n^{\prime}=1}^{(B/\sqrt{x^{\prime}})^{1/2}}G_{x^{\prime}}(dn^{\prime})=\sum_{n=1}^{d(B/\sqrt{x^{\prime}})^{1/2}}a_{x^{\prime},d,n}.$

We will apply the Wiener-Ikehara Tauberian theorem here. Thus, as we did in
the previous section, we will do the following.

  1. 1.

We show that $L_{x^{\prime},d}(s)$ can be meromorphically continued to
$\Re(s)>1/2$, with a simple pole at $s=1$.

  2. 2.

We find the residue of $L_{x^{\prime},d}(s)$ at $s=1$.

  3. 3.

We use the Wiener-Ikehara Tauberian theorem as in Theorem 8.1 to obtain an
estimate on the sum of the coefficients on $L_{x^{\prime},d}(s)$, with an
acceptable error term.

We will follow similar steps as the last section. Let
$\chi\in\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])}$. Then,
define $L_{d}(\chi,s)=\sum_{n=1}^{\infty}\frac{a_{\chi,d,n}}{n^{s}}$, where

$a_{\chi,d,n}=\begin{cases}\sum_{\text{ideals
}I\subset{\mathcal{O}}_{{\mathbb{Q}}[\sqrt{-x^{\prime}}]}:N(I)=n}\chi(I)&d|n\\\
0&\text{ otherwise}\end{cases},$

so that
$L_{x^{\prime},d}(s)=\frac{1}{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}\sum_{\chi\in\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}}L_{d}(\chi,s).$

Let

$\displaystyle P_{1}=\\{\text{primes }p|p\text{ splits in
}{\mathbb{Q}}[\sqrt{-x^{\prime}}]\\}$ $\displaystyle P_{0}=\\{\text{primes
}p|p\text{ is inert in }{\mathbb{Q}}[\sqrt{-x^{\prime}}]\\}$ $\displaystyle
P_{ram}=\\{\text{primes }p|p\text{ ramifies in
}{\mathbb{Q}}[\sqrt{-x^{\prime}}]\\}.$

Also let $v_{p}(d)$ denote the exponent of $p$ in $d$.

Define

$L_{x^{\prime},d}(s)=\frac{1}{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}\sum_{\chi\in\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])}}L_{d}(\chi,s)$

where

$L_{d}(\chi,s)=\prod_{p\in
P_{1}}\sum_{i=v_{p}(d)}^{\infty}\frac{\sum_{j=0}^{i}\chi(\pi^{j}\bar{\pi}^{i-j})}{p^{is}}\prod_{p\in
P_{0}}\sum_{i=\lceil
v_{p}(d)/2\rceil}^{\infty}\frac{\chi(p^{2i})}{p^{2is}}\prod_{p\in
P_{ram}}\sum_{i=v_{p}(d)}^{\infty}\frac{\chi(\pi^{i})}{p^{is}},$

where $\pi,\bar{\pi}$ are primes lying above $p$.

There are two remarks on this function. One remark is that $L_{1}(\chi,s)$ is
just the Hecke L-function $L(\chi,s)$. The second remark on this function is
that there is a relationship between $L_{1}(\chi,s)$ and $L_{d}(\chi,s)$ given
by

$\displaystyle L_{d}(\chi,s)$ $\displaystyle=L_{1}(\chi,s)\prod_{p\in
P_{1}}\frac{\sum_{i=v_{p}(d)}^{\infty}\frac{\sum_{j=0}^{i}\chi(\pi^{j}\bar{\pi}^{i-j})}{p^{is}}}{\sum_{i=0}^{\infty}\frac{\sum_{j=0}^{i}\chi(\pi^{j}\bar{\pi}^{i-j})}{p^{is}}}\prod_{p\in
P_{0}}\frac{\sum_{i=\lceil
v_{p}(d)/2\rceil}^{\infty}\frac{\chi(p^{2i})}{p^{2is}}}{\sum_{i=0}^{\infty}\frac{\chi(p^{2i})}{p^{2is}}}\prod_{p\in
P_{ram}}\frac{\sum_{i=v_{p}(d)}^{\infty}\frac{\chi(\pi^{i})}{p^{is}}}{\sum_{i=0}^{\infty}\frac{\chi(\pi^{i})}{p^{is}}}$
$\displaystyle=L_{1}(\chi,s)Q_{d,1}(\chi,s)Q_{d,0}(\chi,s)Q_{d,ram}(\chi,s),$

where $Q_{d,1}$, $Q_{d,0}$, and $Q_{d,ram}$ are holomorphic over $Re(s)>0$.

######  Lemma 5.1.

$L_{x^{\prime},d}(s)$ is meromorphic over $Re(s)>0$, and only has a pole at
$s=1$ of residue
$\frac{1}{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}\operatorname{Res}_{s=1}L_{d}(\chi_{\operatorname{triv}},s)$.

###### Proof.

$L_{x^{\prime},d}(s)$ is an average of $L_{d}(\chi,s)$ as $\chi$ varies over
$\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}$. Now
$L_{d}(\chi,s)=L_{1}(\chi,s)Q_{d,1}(\chi,s)Q_{d,0}(\chi,s)Q_{d,ram}(\chi,s)$,
with each factor holomorphic over $Re(s)>0$, except possibly $L_{1}(\chi,s)$
when $\chi=\chi_{\operatorname{triv}}$, in which case there is a pole at
$s=1$. Thus, the residue of $L_{x^{\prime},d}(s)$ at $s=1$ is
$\frac{1}{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}\operatorname{Res}_{s=1}L_{d}(\chi_{\operatorname{triv}},s)$.
∎

######  Lemma 5.2.

$\operatorname{Res}_{s=1}L_{x^{\prime},d}(s)=O\left(\frac{1}{\sqrt{x^{\prime}}}\prod_{p\in
P_{1}}\frac{v_{p}(d)+1}{p^{v_{p}(d)}}\prod_{p\in P_{0}}\frac{1}{p^{2\lceil
v_{p}(d)/2\rceil}}\prod_{p\in P_{ram}}\frac{1}{p^{v_{p}(d)}}\right).$

###### Proof.

Since we’re looking at the residue at $1$, and by Lemma 5.1, we just need to
look at $L_{d}(\chi_{\operatorname{triv}},s)$. We have

$L_{d}(\chi_{\operatorname{triv}},s)=L_{1}(\chi_{\operatorname{triv}},s)Q_{d,1}(\chi_{\operatorname{triv}},s)Q_{d,0}(\chi_{\operatorname{triv}},s)Q_{d,ram}(\chi_{\operatorname{triv}},s).$

Since all factors besides $L_{1}(\chi_{\operatorname{triv}},s)$ are entire, we
focus on the residue of $L_{1}(\chi_{\operatorname{triv}},s)$ at $1$. However,
this is just the Dedekind zeta function of ${\mathbb{Q}}[\sqrt{-x^{\prime}}]$.
Thus, by the class number formula, $L_{1}(\chi_{\operatorname{triv}},s)$ has
residue at $1$ bounded by
$C_{0}\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{\sqrt{x^{\prime}}}$,
where $C_{0}$ is a constant independent of $x^{\prime}$. Thus,
$L_{d}(\chi_{\operatorname{triv}},1)$ has residue bounded by

$C_{0}\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{\sqrt{x^{\prime}}}Q_{d,1}(\chi_{\operatorname{triv}},1)Q_{d,0}(\chi_{\operatorname{triv}},1)Q_{d,ram}(\chi_{\operatorname{triv}},1).$

Thus, $L_{d,x^{\prime}}(s)$ has residue bounded by

$C_{0}\frac{Q_{d,1}(\chi_{\operatorname{triv}},1)Q_{d,0}(\chi_{\operatorname{triv}},1)Q_{d,ram}(\chi_{\operatorname{triv}},1)}{\sqrt{x^{\prime}}}.$

Now, we investigate $Q_{d,1}(\chi_{\operatorname{triv}},1)$. A local factor of
$Q_{d,1}(\chi_{\operatorname{triv}},1)$ is of the form
$\frac{\sum_{i=v_{p}(d)}^{\infty}\frac{i+1}{p^{i}}}{\sum_{i=0}^{\infty}\frac{i+1}{p^{i}}}$,
and we have the bound

$\frac{\sum_{i=v_{p}(d)}^{\infty}\frac{i+1}{p^{i}}}{\sum_{i=0}^{\infty}\frac{i+1}{p^{i}}}=p^{-v_{p}(d)}\frac{\sum_{i=0}^{\infty}\frac{v_{p}(d)+i+1}{p^{i}}}{\sum_{i=0}^{\infty}\frac{i+1}{p^{i}}}=(v_{p}(d)+1)p^{-v_{p}(d)}\frac{\sum_{i=0}^{\infty}\frac{1+i/(v_{p}(d)+1)}{p^{i}}}{\sum_{i=0}^{\infty}\frac{i+1}{p^{i}}}\leq(v_{p}(d)+1)p^{-v_{p}(d)}.$

Similar analyses of $Q_{d,0}(\chi_{\operatorname{triv}},1)$ and
$Q_{d,ram}(\chi_{\operatorname{triv}},1)$ yields that

$Q_{d,1}(\chi_{\operatorname{triv}},1)Q_{d,0}(\chi_{\operatorname{triv}},1)Q_{d,ram}(\chi_{\operatorname{triv}},1)\leq\prod_{p\in
P_{1}}\frac{v_{p}(d)+1}{p^{v_{p}(d)}}\prod_{p\in P_{0}}\frac{1}{p^{2\lceil
v_{p}(d)/2\rceil}}\prod_{p\in P_{ram}}\frac{1}{p^{v_{p}(d)}}.$

∎

######  Lemma 5.3.

Assuming GRH, for all $\epsilon_{1}>0$,

$L_{x^{\prime},d}(\chi,1/2+it)=O_{\epsilon_{1}}(|x^{\prime}t|^{\epsilon_{1}}d^{-1/2}\prod_{p|d}\frac{v_{p}(d)+1}{(1-p^{-1/2})^{4}}).$

###### Proof.

Since $L_{x^{\prime},d}$ is an average of $L_{d}(\chi,s)$, we just need to
show the same bound for $L_{d}(\chi,s)$.

$L_{d}(\chi,s)=L_{1}(\chi,s)Q_{d,1}(\chi,s)Q_{d,0}(\chi,s)Q_{d,ram}(\chi,s).$

We will bound $L_{1}(\chi,1/2+it)$ and
$Q_{d,1}(\chi,1/2+it)Q_{d,0}(\chi,1/2+it)Q_{d,ram}(\chi,1/2+it)$ separately.

The analytic conductor of $L_{1}(\chi,1/2+it)$ is $x^{\prime}$. Since we are
assuming GRH, we may use [7, Cor. 5.20] to obtain
$L_{1}(\chi,1/2+it)=O_{\epsilon_{1}}(|x^{\prime}t|^{\epsilon_{1}})$.

For $Q_{d,1}(\chi,1/2+it)Q_{d,0}(\chi,1/2+it)Q_{d,ram}(\chi,1/2+it)$, we will
bound as follows. Consider one local factor from $Q_{d,1}$. For example,

$\frac{\sum_{j=v_{p}(d)}^{\infty}\frac{\sum_{l=0}^{j}\chi(\pi^{l}\bar{\pi}^{j-l})}{p^{(1/2+it)j}}}{\sum_{j=0}^{\infty}\frac{\sum_{l=0}^{j}\chi(\pi^{l}\bar{\pi}^{j-l})}{p^{(1/2+it)j}}}.$

We may upper bound the numerator by

$\sum_{j=v_{p}(d)}^{\infty}\frac{j+1}{p^{j/2}}=\frac{1}{p^{v_{p}(d)/2}}\sum_{j=0}^{\infty}\frac{j+1+v_{p}(d)}{p^{j/2}}=\frac{1}{p^{v_{p}(d)/2}}(\frac{1}{(1-p^{-1/2})^{2}}+\frac{v_{p}(d)}{1-p^{-1/2}}).$

As for the denominator, we may write it as

$(1-\chi(\pi)p^{-1/2+it})^{-1}(1-\overline{\chi(\pi)}p^{-1/2+it})^{-1},$

with the individual products lower bounded by $(1+p^{-1/2})^{-1}$, and so we
obtain a upper bound of

$\frac{1}{p^{v_{p}(d)/2}}(1+p^{-1/2})^{2}((1-p^{-1/2})^{-2}+v_{p}(d)(1-p^{-1/2})^{-1})\leq\frac{v_{p}(d)+1}{p^{v_{p}(d)/2}(1-p^{-1/2})^{4}}$

for the local factor at $p$. So, $Q_{d,1}(\chi,1/2+it)$ may be bounded by

$\prod_{p|d,p\in P_{1}}\frac{v_{p}(d)+1}{p^{v_{p}(d)/2}(1-p^{-1/2})^{4}}.$

We may apply a similar argument to $Q_{d,0}$ and upper bound
$Q_{d,0}(\chi,1/2)$ by

$\prod_{p|d,p\in P_{0}}\frac{1}{p^{2\lceil
v_{p}(d)/2\rceil}}\frac{(1-p^{-1})^{-1}}{(1+p^{-1})^{-1}}\leq\prod_{p|d,p\in
P_{0}}\frac{1}{p^{\lceil v_{p}(d)/2\rceil}}(1-p^{-1})^{-2}\leq\prod_{p|d,p\in
P_{0}}\frac{v_{p}(d)+1}{p^{v_{p}(d)/2}(1-p^{-1/2})^{4}}.$

As for $Q_{d,ram}$, we obtain an upper bound of

$\prod_{p|d,p\in
P_{ram}}\frac{1}{p^{v_{p}(d)/2}}(1-p^{-1/2})^{-2}\leq\prod_{p|d,p\in
P_{ram}}\frac{v_{p}(d)+1}{p^{v_{p}(d)/2}(1-p^{-1/2})^{4}}.$

Thus, we obtain that

$|Q_{d,1}(\chi,1/2+it)Q_{d,0}(\chi,1/2+it)Q_{d,ram}(\chi,1/2+it)|\leq
d^{-1/2}\prod_{p|d}\frac{v_{p}(d)+1}{(1-p^{-1/2})^{4}}$

∎

We now have all the ingredients for the Wiener-Ikehara Tauberian Theorem.

######  Proposition 5.4.

Assuming GRH, for all $\epsilon_{1}>0$,

$\sum_{d=1}^{X}\sum_{n=1}^{X}G_{x^{\prime}}(dn)=O_{\epsilon_{1}}\left(\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{x^{\prime}\prod_{p|x^{\prime}}(1-1/p)}X^{2}+x^{\prime\epsilon_{1}}X^{3/2+\epsilon_{1}}\right).$

###### Proof.

Using the conclusions of Lemmas 5.1, 5.2, and 5.3, we may apply Theorem 8.1 in
the appendix, with $b=1$, $a=1$, $\kappa=1$, and
$r=d^{-1/2}\prod_{p|d}\frac{v_{p}(d)+1}{(1-p^{-1/2})^{4}}$. We then obtain

$\sum_{n=1}^{X}G_{x^{\prime}}(dn)=O_{\epsilon_{1}}(\frac{Xd}{\sqrt{x^{\prime}}}\prod_{p\in
P_{1}}\frac{v_{p}(d)+1}{p^{v_{p}(d)}}\prod_{p\in P_{0}}\frac{1}{p^{2\lceil
v_{p}(d)/2\rceil}}\prod_{p\in
P_{ram}}\frac{1}{p^{v_{p}(d)}}+x^{\prime\epsilon_{1}}(Xd)^{1/2+\epsilon_{1}}d^{-1/2}\prod_{p|d}\frac{v_{p}(d)+1}{(1-p^{-1/2})^{4}}).$

First we deal with the first term.

$\sum_{d=1}^{X}\frac{Xd}{\sqrt{x^{\prime}}}\prod_{p\in
P_{1}}\frac{v_{p}(d)+1}{p^{v_{p}(d)}}\prod_{p\in P_{0}}\frac{1}{p^{2\lceil
v_{p}(d)/2\rceil}}\prod_{p\in
P_{ram}}\frac{1}{p^{v_{p}(d)}}=\frac{X}{\sqrt{x^{\prime}}}\sum_{d=1}^{X}\prod_{p\in
P_{1}}(v_{p}(d)+1)\prod_{p\in P_{0}}\frac{1}{p^{2\lceil v_{p}(d)/2\rceil-
v_{p}(d)}}.$

To estimate the sum, we may again use the Tauberian theorem (Theorem 8.1)
associated to the $L$-function given by the Euler product

$\prod_{p\in P_{1}}(1+\frac{2}{p^{s}}+\frac{3}{p^{2s}}+\dots)\prod_{p\in
P_{0}}(1+\frac{2}{p^{2s}}+\frac{2}{p^{4s}}+\dots).$

But this is almost exactly the Dedekind Zeta Function of
${\mathbb{Q}}[\sqrt{-x^{\prime}}]$. Indeed, the Dedekind Zeta Function of
${\mathbb{Q}}[\sqrt{-x^{\prime}}]$ is

$\prod_{p\in P_{1}}(1+\frac{2}{p^{s}}+\frac{3}{p^{2s}}+\dots)\prod_{p\in
P_{0}}(1+\frac{1}{p^{2s}}+\frac{1}{p^{4s}}+\dots)\prod_{p\in
P_{ram}}\left(1+\frac{1}{p^{s}}+\frac{1}{p^{2s}}+\dots\right).$

So, by the class number formula and the Tauberian theorem,

$\sum_{d=1}^{X}\prod_{p\in P_{1}}(v_{p}(d)+1)\prod_{p\in
P_{0}}\frac{1}{p^{2\lceil v_{p}(d)/2\rceil-
v_{p}(d)}}=O_{\epsilon_{1}}\left(\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{\sqrt{x^{\prime}}\prod_{p|x^{\prime}}(1-1/p)}X+x^{\prime\epsilon_{1}}X^{1/2+\epsilon_{1}}\right).$

Thus, our final estimate for the first term is

$O_{\epsilon_{1}}\left(\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{x^{\prime}\prod_{p|x^{\prime}}(1-1/p)}X^{2}+X^{3/2+\epsilon_{1}}x^{\prime\epsilon_{1}}\right)$

Now we deal with the second term,

$\displaystyle\sum_{d=1}^{X}x^{\prime\epsilon_{1}}(Xd)^{1/2+\epsilon_{1}}d^{-1/2}\prod_{p|d}\frac{v_{p}(d)+1}{(1-p^{-1/2})^{4}}$
$\displaystyle=x^{\prime\epsilon_{1}}X^{1/2+\epsilon_{1}}\sum_{d=1}^{X}d^{\epsilon_{1}}\prod_{p|d}\frac{v_{p}(d)+1}{(1-p^{-1/2})^{4}}$
$\displaystyle\leq
x^{\prime\epsilon_{1}}X^{1/2+2\epsilon_{1}}\sum_{d=1}^{X}\prod_{p|d}\frac{v_{p}(d)+1}{(1-p^{-1/2})^{4}}.$

For the summation, we may again use the Tauberian theorem on the $L$-function
associated to the Euler product

$\prod_{p}\left(1+\frac{2(1-p^{-1/2})^{-4}}{p^{s}}+\frac{3(1-p^{-1/2})^{-4}}{p^{2s}}+\dots\right)$

Given that $(1-2^{-1/2})^{-4}\leq 136$, the coefficients of this $L$-function
is certainly bounded by the coefficients of the $L$-function associated to the
product

$\prod_{p}\left(1+\frac{2\cdot 136}{p^{s}}+\frac{3\cdot
136}{p^{2s}}+\dots\right).$

The Tauberian theorem (Theorem 8.1) with $b=2\cdot 136=272$ then gives us
something on the order of $X(\log X)^{272}=O(X^{1+\epsilon_{1}})$. So, the
final estimate of the second term is
$O_{\epsilon_{1}}(x^{\prime\epsilon_{1}}X^{3/2+3\epsilon_{1}})$.

Consequently,

$\sum_{d=1}^{X}\sum_{n=1}^{X}G_{x^{\prime}}(dn)=O_{\epsilon_{1}}\left(\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{x^{\prime}\prod_{p|x^{\prime}}(1-1/p)}X^{2}+x^{\prime\epsilon_{1}}X^{3/2+\epsilon_{1}}\right).$

∎

######  Corollary 5.5.

Assuming GRH, for all $\epsilon_{1}>0$,

$|S_{x}|=O_{\epsilon_{1}}\left(\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{x^{\prime
3/2}\prod_{p|x^{\prime}}(1-1/p)}B+B^{3/4+\epsilon_{1}}x^{\prime-3/8+\epsilon_{1}}\right)$

###### Proof.

Apply Proposition 5.4 to $X=(B/\sqrt{x^{\prime}})^{1/2}$. ∎

Finally, we get our proposition

###### Proof of Proposition 3.9.

By the preceding corollary, we have

$\sum_{-B^{2/5-\epsilon}\leq
x\leq-1,\text{squarefree}}|S_{x}|=O_{\epsilon_{1}}\left(\sum_{x^{\prime}=1}^{B^{2/5-\epsilon}}\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{x^{\prime
3/2}\prod_{p|x^{\prime}}(1-1/p)}B+\frac{B^{3/4+\epsilon_{1}}}{x^{\prime
3/8+\epsilon_{1}}}\right).$

Choosing $\epsilon_{1}=\frac{25}{56}\epsilon$, we get

$\sum_{-B^{2/5-\epsilon}\leq
x\leq-1,\text{squarefree}}|S_{x}|=O_{\epsilon}\left(B\sum_{x^{\prime}=1,\text{
squarefree}}^{B^{2/5-\epsilon}}\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{x^{\prime
3/2}\prod_{p|x^{\prime}}(1-1/p)}\right)+O_{\epsilon}(B).$

Thus, we see that it suffices to show that

$\sum_{x^{\prime}=1,\text{
squarefree}}^{B^{2/5-\epsilon}}\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{x^{\prime
3/2}\prod_{p|x^{\prime}}(1-1/p)}=O(\log B).$

Now it follows from the Class Number Formula and the fact that the Dedekind
Zeta Function of a quadratic extension splits as a product of $L$-functions
that
$\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{\sqrt{x^{\prime}}}=O(L(\chi_{-x^{\prime}},1))$,
where we recall $\chi_{-x^{\prime}}$ is defined to be the Jacobi Symbol
$(\frac{-x^{\prime}}{n})$. Thus, we may write

$\sum_{x^{\prime}=1,\text{
squarefree}}^{B^{2/5-\epsilon}}\frac{|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x^{\prime}}])|}{x^{\prime
3/2}\prod_{p|x^{\prime}}(1-1/p)}=O\left(\sum_{x^{\prime}=1}^{B^{2/5-\epsilon}}\frac{L(\chi_{-x^{\prime}},1)|\mu(x^{\prime})|}{x^{\prime}\prod_{p|x^{\prime}}(1-1/p)}\right).$

Now, for $x^{\prime}$ squarefree,

$\frac{1}{\prod_{p|x^{\prime}}(1-1/p)}=\prod_{p|x^{\prime}}(1+\frac{1}{p-1})=\sum_{d|x^{\prime}}\frac{1}{\phi(d)}.$

So,

$\displaystyle\sum_{x^{\prime}=1}^{B^{2/5-\epsilon}}\frac{L(\chi_{-x^{\prime}},1)|\mu(x^{\prime})|}{x^{\prime}\prod_{p|x^{\prime}}(1-1/p)}$
$\displaystyle=\sum_{x^{\prime}=1}^{B^{2/5-\epsilon}}\sum_{d|x^{\prime}}\frac{L(\chi_{-x^{\prime}},1)|\mu(x^{\prime})|}{x^{\prime}\phi(d)}$
$\displaystyle=O\left(\sum_{d=1}^{B^{2/5-\epsilon}}\sum_{x^{\prime\prime}=1}^{B^{2/5-\epsilon}/d}\frac{L(\chi_{-dx^{\prime\prime}},1)|\mu(dx^{\prime\prime})|}{dx^{\prime\prime}\phi(d)}\right)$
$\displaystyle=O\left(\sum_{d=1}^{B^{2/5-\epsilon}}\frac{|\mu(d)|}{d\phi(d)}\sum_{x^{\prime}=1,\gcd(d,x^{\prime})=1}^{B^{2/5-\epsilon}/d}\frac{L(\chi_{-dx^{\prime}},1)|\mu(x^{\prime})|}{x^{\prime}}\right).$

Since $L(\chi_{-dx^{\prime}},1)$ is always nonnegative, we have also that

$\sum_{x^{\prime}=1,(d,x)=1}^{B^{2/5-\epsilon}/d}\frac{L(\chi_{-dx^{\prime}},1)|\mu(x^{\prime})|}{x^{\prime}}\leq\sum_{x^{\prime}=1}^{B^{2/5-\epsilon}/d}\frac{L(\chi_{-dx^{\prime}},1)|\mu(x^{\prime})|}{x^{\prime}}.$

By Lemma 4.5, we have that

$\sum_{x^{\prime}=1}^{B^{2/5-\epsilon}/d}\frac{L(\chi_{-dx^{\prime}},1)|\mu(x^{\prime})|}{x^{\prime}}=O(\log(B^{2/5-\epsilon}))+O(d^{1/2}\log
d).$

So,

$\sum_{d=1}^{B^{2/5-\epsilon}}\frac{1}{d\phi(d)}\sum_{x^{\prime}=1,\gcd(d,x^{\prime})=1}^{B^{2/5-\epsilon}/d}\frac{L(\chi_{-dx^{\prime}},1)|\mu(x^{\prime})|}{x^{\prime}}=\sum_{d=1}^{B^{2/5-\epsilon}}\frac{O(\log
B+d^{1/2}\log d)}{d\phi(d)}=O(\log B)$

∎

##  6 Upper Bound of $|S_{y}|$ for $1\leq y\leq B^{5/19-\epsilon}$

Figure 1: The graph of $(r+c^{2})\sqrt{|r-c^{2}|}=8$ is in blue. Our goal is
to obtain a weighted count of lattice points in certain congruence classes
within regions of this shape. In the first case with $c\leq(By)^{1/3}$, we
will obtain an upper bound through considering the lattice points within the
red rectangle. In our second case with $(By)^{1/3}\leq c\leq
B^{1/2-\delta}/y^{3/10}$, we will obtain an upper bound through considering
lattice points in the black rectangles. Finally, for the last case where
$B^{1/2-\delta}/y^{3/10}\leq c$, we will use a trivial estimate.

Our goal this section is to prove Proposition 3.10. We first introduce a new
set $S_{y}^{\prime}$, into which $S_{y}$ will inject. First, note that

$S_{y}=\\{(a,b,c):\max(|a|,|b|,|c|)^{2}\sqrt{|\operatorname{sqf}(a^{2}+b^{2}-c^{2})|}\leq
B,\operatorname{sqf}(a^{2}+b^{2}-c^{2})\notin\\{0,1\\},\operatorname{sq}(a^{2}+b^{2}-c^{2})=y\\}$

is in bijection with

$\\{(a,b,c):\max(|a|,|b|,|c|)^{2}\sqrt{|a^{2}+b^{2}-c^{2}|}\leq
By,y=\operatorname{sq}(a^{2}+b^{2}-c^{2}),\operatorname{sqf}(a^{2}+b^{2}-c^{2})\notin\\{0,1\\}\\}.$

Next, since we’re looking for an upper bound, we may replace
$\max(|a|,|b|,|c|)^{2}$ with $\frac{1}{3}(a^{2}+b^{2}+c^{2})$. We may also
replace the constraint $y=\operatorname{sq}(a^{2}+b^{2}-c^{2})$ with the
looser requirement that $y^{2}|a^{2}+b^{2}-c^{2}$ and $a^{2}+b^{2}-c^{2}\neq
0$. Thus, $S_{y}$ injects into

$\\{(a,b,c):(a^{2}+b^{2}+c^{2})\sqrt{|a^{2}+b^{2}-c^{2}|}\leq
3By,y^{2}|a^{2}+b^{2}-c^{2},a^{2}+b^{2}-c^{2}\neq 0\\}.$

We define

$S_{y}^{\prime}:=\\{(a,b,c):(a^{2}+b^{2}+c^{2})\sqrt{|a^{2}+b^{2}-c^{2}|}\leq
By,y^{2}|a^{2}+b^{2}-c^{2},a^{2}+b^{2}-c^{2}\neq 0\\},$

which is essentially the above set, except the $3$ is removed. We will proceed
to show that

$\sum_{1\leq y\leq B^{5/19-\epsilon}}|S_{y}^{\prime}|=O_{\epsilon}(B\log B),$

which will show that

$\sum_{1\leq y\leq
B^{5/19-\epsilon}}|S_{y}|=O_{\epsilon}((3B)\log(3B))=O_{\epsilon}(B\log B).$

Let $r=a^{2}+b^{2}$, then let

$R_{y}=\\{(r,c):(r+c^{2})\sqrt{|r-c^{2}|}\leq By,y^{2}|r-c^{2},r-c^{2}\neq
0\\}.$

Then, we have

$|S_{y}^{\prime}|=4\sum_{(r,c)\in R_{y}}F(r),$

where we recall $F(r)$ is the number of ways to write $r$ as a sum of two
positive squares. So, we will bound this sum. Note that $c$ is at most
$B^{1/2}$. So, we will write this sum as

$\sum_{c=1}^{B^{1/2}}\sum_{(r,c)\in R_{y}}F(r).$

Now, having fixed $c$, the inner sum $\sum_{(r,c)\in R_{y}}F(r)$ is a sum over
integers $r\equiv c^{2}\mod y^{2}$ within a certain range. For example, if
$c\leq(By)^{1/3}$, then the constraint $(r+c^{2})\sqrt{|r-c^{2}|}\leq By$ is
implied by $r\leq 2(By)^{2/3}$. The region of such $r,c$ is pictorially
represented by the red box in Figure 1. So, fixing a $c\leq(By)^{1/3}$, we
would have that

$\sum_{(r,c)\in R_{y}}F(r)\leq\sum_{r\leq 2(By)^{2/3},r\equiv c^{2}\mod
y^{2}}F(r).$

By the squareroot law, one would guess that

$\sum_{r\leq(By)^{2/3},r\equiv c^{2}\mod
y^{2}}F(r)=M(c,y)\frac{2(By)^{2/3}}{y^{2}}+E(c)$

where $M(c,y)$ is some constant and $E(c)$ would be somewhere on the order of
$\frac{\sqrt{2}(By)^{1/3}}{y}$. However, such error estimates are only
conjectured [10, Conj. 13.9] and it would turn out that applying the Tauberian
theorem to the appropriate L-function would only give us
$E=O_{\epsilon}((By)^{1/3+\epsilon})$, which turns out to not be good enough
once we sum over $c$ and $y$. Despite this, we do have an averaged version of
our conjectured error term. That is, we can obtain a good estimate of
$\sum_{c=M}^{N}E(c)$, when $N-M$ is big. Thus, in the first two cases, we
upper bound our sum with multiple rectangles as in Figure 1.

Our strategy is as follows.

  1. 1.

Give an estimate of the sum $\sum_{m}\sum_{r\equiv m^{2}\mod y^{2}}F(r)$ where
$m,r$ vary in some large intervals as a main term plus an averaged error term.
Note that the indices in this sum correspond to the lattice points in the red
and black boxes in Figure 1. In practice, we will place slightly more
restrictions on $m$.

  2. 2.

Apply the bounds to the first and second cases as in Figure 1.

  3. 3.

Finally, we have a trivial estimate for the third case of Figure 1, and
conclude.

We start with the first step, and attempt to obtain a good averaged error
term. First we shall introduce some notations. Fix a residue class $c^{2}\mod
y^{2}$. Let $l=(c,y)$. Let
$\widehat{({\mathbb{Z}}/(y^{2}/l^{2}){\mathbb{Z}})^{\times}}$ be the
characters of the multiplicative group
$({\mathbb{Z}}/(y^{2}/l^{2}){\mathbb{Z}})^{\times}$. We have that

$\displaystyle\sum_{r=1,r\equiv c^{2}\mod y^{2}}^{X}F(r)$
$\displaystyle=\sum_{r=1,r\equiv(c/l)^{2}\mod(y/l)^{2}}^{X/l^{2}}F(rl^{2})$
$\displaystyle=\frac{1}{\phi(y^{2}/l^{2})}\sum_{\chi\in\widehat{({\mathbb{Z}}/(y^{2}/l^{2}){\mathbb{Z}})^{\times}}}\chi((c/l)^{2})\sum_{r=1}^{X/l^{2}}F(rl^{2})\overline{\chi}(r).$

Now, fix $\chi\in\widehat{({\mathbb{Z}}/(y^{2}/l^{2}){\mathbb{Z}})^{\times}}$
and consider

$L^{l}(\chi,s)=\sum_{i=2v_{2}(l)}^{\infty}\frac{\chi(2^{i-2v_{2}(l)})}{2^{is}}\prod_{p\equiv
1\mod
4}\sum_{i=2v_{p}(l)}^{\infty}\frac{(i+1)\chi(p^{i-2v_{p}(l)})}{p^{is}}\prod_{p\equiv
3\mod 4}\sum_{i=v_{p}(l)}^{\infty}\frac{\chi(p^{2i-2v_{p}(l)})}{p^{2is}}.$

Let $a^{l}_{\chi,n}$ be the $n$-th coefficient of this $L$-function. Then,

$a^{l}_{\chi,n}=\begin{cases}F(n)\chi(n/l^{2})&l^{2}|n\\\ 0&l^{2}\nmid
n\end{cases}.$

Thus,
$\sum_{r=1}^{X/l^{2}}F(rl^{2})\overline{\chi}(r)=\sum_{n=1}^{X}a^{l}_{\chi,n}$.
Consider the Hecke character lift $\chi_{\operatorname{adelic}}$ of $\chi$
defined by
$\chi_{\operatorname{adelic}}=\chi_{\infty}\prod_{\pi\in\operatorname{Spec}({\mathbb{Z}}[i])}\chi_{\pi}$,
where $\chi_{\pi}$’s and $\chi_{\infty}$ are defined as follows. Define
$f_{\pi}\in{\mathbb{Z}}$ so that $y^{2}/l^{2}$ factorizes as
$\prod_{\pi}\pi^{f_{\pi}}$ in ${\mathbb{Z}}[i]$. Then, given
$x_{\pi}\in{\mathbb{Z}}[i]_{\pi}$, define

$\chi_{\pi}(x_{\pi})=\begin{cases}\chi(N(\pi))^{m}&x_{\pi}\in\pi^{m}{\mathbb{Z}}[i]_{\pi},\pi\nmid
y^{2}/l^{2}\\\
\chi(N(j))&x_{\pi}\in\pi^{k}(j+\pi^{f_{\pi}}{\mathbb{Z}}[i]_{\pi}),j\in{\mathbb{Z}}[i],k\in{\mathbb{Z}},\pi\nmid
j,\pi|y^{2}/l^{2}.\end{cases}$

For, $\chi_{\infty}$, we define it to be

$\chi_{\infty}(x_{\infty})=\begin{cases}1&\chi(-1)=1\\\
1&\chi(-1)=-1,N(x_{\infty})>0\\\ -1&\chi(-1)=-1,N(x_{\infty})<0\\\
\end{cases}.$

With this definition, we see that $L^{l}(\chi,s)$ is just a modification of
the Hecke L-function $L_{{\mathbb{Q}}[i]}(\chi_{\operatorname{adelic}},s)$. We
have

$L^{l}(\chi,s)=L_{{\mathbb{Q}}[i]}(\chi_{\operatorname{adelic}},s)l^{-2s}\prod_{p|l,p\equiv
1\mod 4}Q_{\chi,l,p}(s),$

where

$Q_{\chi,l,p}(s)=\frac{\sum_{i=0}^{\infty}(2v_{p}(l)+1+i)\chi(p^{i})/p^{is}}{\sum_{i=0}^{\infty}(i+1)\chi(p^{i})/p^{is}}.$

With this form of $L^{l}(\chi,s)$, we may obtain an estimate on the sum
$\sum_{n=1}^{X}a^{l}_{\chi,n}$ via Perron’s formula. Note that we cannot use
the Tauberian theorem as this $L$-function does not have positive coefficients
for nontrivial $\chi$.

Our step one is to prove the following averaged error.

######  Proposition 6.1.

Assuming GRH, for all $\epsilon>0$, we have

$\sum_{m=M,(m,(y/l))=1}^{N}\left\lvert\sum_{\begin{subarray}{c}r=1\\\ r\equiv
m^{2}\mod(y/l)^{2}\end{subarray}}^{X/l^{2}}F(rl^{2})-\frac{X}{\phi((y/l)^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\right\lvert$
$=\begin{cases}O(\frac{1}{l}(N-M)^{1/2}y^{\epsilon}X^{1/2+\epsilon})&N-M\leq(y/l)^{2}\\\
O(\frac{N-M}{y}y^{\epsilon}X^{1/2+\epsilon})&\text{ otherwise}\end{cases}$

This will be obtained through a technical lemma applied to estimates on the
sums of coefficients of $L^{l}(\chi,s)$. One should compare this to the
“unaveraged” error term

$O(\frac{N-M}{l}y^{\epsilon}X^{1/2+\epsilon}),$

which can be obtained by directly applying the Tauberian theorem. With the
averaged error term, one saves a factor of $\min(y/l,\sqrt{N-M})$, which will
be crucial in the case where $l$ is small.

######  Lemma 6.2.

Let $l|y$. Let $\chi\in\widehat{({\mathbb{Z}}/(y/l)^{2}{\mathbb{Z}})}$ be any
character. Assuming GRH, for all $\epsilon>0$,

$L^{l}(\chi,1/2+it)=O_{\epsilon}((|s|y)^{\epsilon}l^{-1})$

###### Proof.

First we have

$L^{l}(\chi,s)=L_{{\mathbb{Q}}[i]}(\chi_{\operatorname{adelic}},s)l^{-2s}\prod_{p|l,p\equiv
1\mod 4}Q_{\chi,l,p}(s).$

For $L_{{\mathbb{Q}}[i]}(\chi_{\operatorname{adelic}},s)$, we may use the GRH
to obtain a bound of $(\frac{y|s|}{l})^{\epsilon}$ on the line $\Re(s)=1/2$.
For $\prod_{p|l}Q_{\chi,l,p}(s)$, we have that for $s$ on the line
$\Re(s)=1/2$,

$\displaystyle|Q_{\chi,l,p}(s)|$
$\displaystyle=\left|\frac{\sum_{i=0}^{\infty}(2v_{p}(l)+1+i)\chi(p^{i})/p^{is}}{\sum_{i=0}^{\infty}(i+1)\chi(p^{i})/p^{is}}\right|$
$\displaystyle=\left|(1-\chi(p)p^{-s})(1-\overline{\chi(p)}p^{-s})\sum_{i=0}^{\infty}(2v_{p}(l)+1+i)\chi(p^{i})/p^{is}\right|$
$\displaystyle\leq\frac{2v_{p}(l)+1}{(1+p^{-1/2})^{2}}\sum_{i=0}^{\infty}(i+1)p^{-i/2}$
$\displaystyle=(2v_{p}(l)+1)\frac{(1+p^{-1/2})^{2}}{(1-p^{-1/2})^{2}}\leq\frac{2v_{p}(l)+1}{(1-p^{-1/2})^{4}}$

Thus, for $s$ on the line $\Re(s)=1/2$,

$\left|\prod_{p|l,p\equiv 1\mod 4}Q_{\chi,l,p}(s)\right|\leq\prod_{p|l,p\equiv
1\mod 4}\frac{2v_{p}(l)+1}{(1-p^{-1/2})^{4}}=O_{\epsilon}(l^{\epsilon}).$

Thus, combining these bounds, and noting that $l\leq y$, we obtain our desired
bound $(y|s|)^{\epsilon}l^{-1}$. ∎

Applying the above lemmas gives us an estimate on the sum of coefficients of
$L^{l}(\chi,s)$, from which we obtain the following lemma. The proof of this
is quite standard. However, we write the proof out to keep track of the error
terms more closely. Specifically, we need to keep track of the error terms as
$l$ and $y$ vary.

######  Lemma 6.3.

Assuming GRH, for all $\epsilon>0$,

$\sum_{r=1}^{X/l^{2}}F(rl^{2})\overline{\chi}(r)=E_{0}(\chi)X+O_{\epsilon}(l^{-1}|y|^{\epsilon}X^{1/2+\epsilon}),$

where

$E_{0}(\chi)=\begin{cases}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)&\chi=\chi_{\operatorname{triv}}\\\
0&\chi\neq\chi_{\operatorname{triv}}.\end{cases}$

###### Proof.

Recall that
$\sum_{r=1}^{X/l^{2}}F(rl^{2})\overline{\chi}(r)=\sum_{n=1}^{X}a^{l}_{\chi,n}$.
So, we shall estimate the latter sum. For the rest of this proof, let
$a_{n}:=a^{l}_{\chi,n}$. Let $X^{\prime}$ be the closest half-integer to $X$.
Perron’s formula [10, Theorem 5.2] gives us that

$\sum_{n=1}^{X^{\prime}}a_{n}=\frac{1}{2\pi
i}\int_{2-iT}^{2+iT}L^{l}(\chi,s)\frac{X^{\prime s}}{s}ds+R,$

where

$R=\frac{1}{\pi}\sum_{X^{\prime}/2<n<X^{\prime}}a_{n}\min(1,\frac{1}{T\log\frac{X^{\prime}}{n}})-\frac{1}{\pi}\sum_{X^{\prime}<n<2X^{\prime}}a_{n}\min(1,\frac{1}{T\log\frac{n}{X^{\prime}}})+O(\frac{X^{\prime
2}}{T}\sum_{n}\frac{|a_{n}|}{n^{2}}).$

Since we took $X^{\prime}$ to be a half-integer $\log\frac{X^{\prime}}{n}$ and
$\frac{n}{X^{\prime}}$ will be bounded from below by

$\log(\frac{X^{\prime}}{X^{\prime}-1/2})\gg\frac{1}{X^{\prime}}.$

Now, $a_{n}=O_{\epsilon}(n^{\epsilon})$, so after choosing $T=X^{\prime 3}$,
we may bound $R$ by $O(1/X^{\prime})$.

Now it comes down to estimating

$\sum_{n=1}^{X^{\prime}}a_{n}=\frac{1}{2\pi
i}\int_{2-iT}^{2+iT}L^{l}(\chi,s)\frac{X^{\prime s}}{s}ds+R,$

where $T=X^{\prime 3}$. For this, we use the GRH, and push the contour of
integration to the left. We will use the contour outlined by the four points
$2-iT,1/2-iT,1/2+iT,2+iT$. Now if $\chi=\chi_{\operatorname{triv}}$, we pick
up a pole at $s=1$ of residue
$X^{\prime}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)$.
Otherwise, there is no pole.

The rest of the estimate comes from the contour. By the Phragmén-Lindelöf
Principle, plus the estimate based on the GRH that
$L^{l}(\chi,1/2+it)=O_{\epsilon}(|yt|^{\epsilon})$, we have

$\left\lvert\int_{2-iT}^{1/2-iT}L^{l}(\chi,s)\frac{X^{\prime
s}}{s}ds\right\lvert\leq|y|^{\epsilon}|T|^{\epsilon}\int_{2-iT}^{1/2-iT}\left\lvert\frac{X^{\prime
s}}{s}\right\lvert ds\leq|y|^{\epsilon}|T|^{\epsilon}\frac{X^{\prime
2}}{T}=O_{\epsilon}(|y|^{\epsilon}).$

Similarly, we also have

$\left\lvert\int_{2+iT}^{1/2+iT}L^{l}(\chi,s)\frac{X^{\prime
s}}{s}ds\right\lvert=O_{\epsilon}(y^{\epsilon}).$

The only part left of the contour is $1/2-iT$ to $1/2+iT$. Here we use Lemma
6.2, and obtain

$\left\lvert\int_{1/2-iT}^{1/2+iT}L^{l}(\chi,s)\frac{X^{\prime
s}}{s}ds\right\lvert=O(l^{-1}|y|^{\epsilon}T^{\epsilon}\int_{1/2-iT}^{1/2+iT}\left\lvert\frac{X^{\prime
s}}{s}\right\lvert ds)=O(l^{-1}|y|^{\epsilon}X^{\prime
1/2}T^{2\epsilon})=O(l^{-1}|y|^{\epsilon}X^{\prime 1/2+\epsilon}).$

After plugging in $X^{\prime}=X+O(1)$, we’re done. ∎

We also have the following technical lemma.

######  Lemma 6.4.

Let $f:\widehat{({\mathbb{Z}}/q{\mathbb{Z}})^{\times}}\to{\mathbb{C}}$ be any
function. Then,

$\sum_{m=1,(m,q)=1}^{q}\left\lvert\sum_{\chi}f(\chi)\chi(m)\right\lvert^{2}=\phi(q)\sum_{\chi}|f(\chi)|^{2}.$

###### Proof.

$\displaystyle\sum_{m=1,(m,q)=1}^{q}\left\lvert\sum_{\chi}f(\chi)\chi(m)\right\lvert^{2}$
$\displaystyle=\sum_{m=1,(m,q)=1}^{q}\sum_{\chi}\sum_{\chi^{\prime}}f(\chi)\chi(m)\overline{f(\chi^{\prime})\chi^{\prime}(m)}$
$\displaystyle=\sum_{\chi}\sum_{\chi^{\prime}}f(\chi)\overline{f(\chi^{\prime})}\sum_{m=1,(m,q)=1}^{q}\chi(m)\overline{\chi^{\prime}(m)}$
$\displaystyle=\sum_{\chi}\sum_{\chi^{\prime}}f(\chi)\overline{f(\chi^{\prime})}\begin{cases}\phi(q)&\chi=\chi^{\prime}\\\
0&\chi\neq\chi^{\prime}\end{cases}$
$\displaystyle=\phi(q)\sum_{\chi}|f(\chi)|^{2}$

∎

Now we may prove the averaged error.

###### Proof of Proposition 6.1.

First, we have Cauchy-Schwarz giving us that

$\displaystyle\sum_{\begin{subarray}{c}m=M\\\
(m,(y/l)^{2})=1\end{subarray}}^{N}\left(\sum_{\begin{subarray}{c}r=1\\\
r\equiv
m^{2}\mod(y/l)^{2}\end{subarray}}^{X/l^{2}}F(rl^{2})-\frac{X}{\phi((y/l)^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\right)$
$\displaystyle\leq(N-M)^{1/2}\sqrt{\sum_{\begin{subarray}{c}m=M\\\
(m,(y/l)^{2})=1\end{subarray}}^{N}\left\lvert\sum_{\begin{subarray}{c}r=1\\\
r\equiv
m^{2}\mod(y/l)^{2}\end{subarray}}^{X/l^{2}}F(rl^{2})-\frac{X}{\phi((y/l)^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\right\lvert^{2}}$
$\displaystyle\leq(N-M)^{1/2}\sqrt{\bigg{\lceil}\frac{N-M}{(y/l)^{2}}\bigg{\rceil}\sum_{\begin{subarray}{c}m=1\\\
(m,(y/l)^{2})=1\end{subarray}}^{(y/l)^{2}}\left\lvert\sum_{\begin{subarray}{c}r=1\\\
r\equiv
m^{2}\mod(y/l)^{2}\end{subarray}}^{X/l^{2}}F(rl^{2})-\frac{X}{\phi((y/l)^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\right\lvert^{2}}$
$\displaystyle=(N-M)^{1/2}\bigg{\lceil}\frac{N-M}{(y/l)^{2}}\bigg{\rceil}^{1/2}\sqrt{\sum_{\begin{subarray}{c}m=1\\\
(m,(y/l)^{2})=1\end{subarray}}^{(y/l)^{2}}\left\lvert\sum_{\begin{subarray}{c}r=1\\\
r\equiv
m^{2}\mod(y/l)^{2}\end{subarray}}^{X/l^{2}}F(rl^{2})-\frac{X}{\phi((y/l)^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\right\lvert^{2}}$

Now

$({\mathbb{Z}}/(y/l)^{2}{\mathbb{Z}})^{\times}\cong\prod_{p|(y/l)^{2}}({\mathbb{Z}}/p^{v_{p}((y/l)^{2})}{\mathbb{Z}})^{\times}.$

Thus, by the structure of unit groups of the form
$({\mathbb{Z}}/p^{i}{\mathbb{Z}})^{\times}$, we have that as $m$ runs between
$1$ and $(y/l)^{2}$ with $(m,(y/l)^{2})=1$, the number of times
$m^{2}\mod(y/l)^{2}$ hits any residue class $\mod(y/l)^{2}$ is at most
$2^{\omega(y/l)}$. Thus, we have the following continued estimate

$\leq(N-M)^{1/2}\bigg{\lceil}\frac{N-M}{(y/l)^{2}}\bigg{\rceil}^{1/2}\sqrt{2^{\omega(y/l)}\sum_{\begin{subarray}{c}m=1\\\
(m,(y/l)^{2})=1\end{subarray}}^{(y/l)^{2}}\left\lvert\sum_{\begin{subarray}{c}r=1\\\
r\equiv
m\mod(y/l)^{2}\end{subarray}}^{X/l^{2}}F(rl^{2})-\frac{X}{\phi((y/l)^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\right\lvert^{2}}$
$\leq(N-M)^{1/2}\bigg{\lceil}\frac{N-M}{(y/l)^{2}}\bigg{\rceil}^{1/2}y^{\epsilon}\sqrt{\sum_{\begin{subarray}{c}m=1\\\
(m,(y/l)^{2})=1\end{subarray}}^{(y/l)^{2}}\left\lvert\sum_{\begin{subarray}{c}r=1\\\
r\equiv
m\mod(y/l)^{2}\end{subarray}}^{X/l^{2}}F(rl^{2})-\frac{X}{\phi((y/l)^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\right\lvert^{2}},$
(6.1)

using the fact that $2^{\omega(y/l)}=O(y^{\epsilon})$.

Next, apply Lemma 6.4 to

$f(\chi)=\frac{1}{\phi((y/l)^{2})}\left(\sum_{r=1}^{X/l^{2}}F(rl^{2})\overline{\chi}(r)-E_{0}(\chi)X\right).$

This will show that

$\displaystyle\sum_{\begin{subarray}{c}m=1\\\
(m,(y/l)^{2})=1\end{subarray}}^{(y/l)^{2}}\left(\sum_{\begin{subarray}{c}r=1\\\
r\equiv
m^{2}\mod(y/l)^{2}\end{subarray}}^{X/l^{2}}F(rl^{2})-\frac{X}{\phi((y/l)^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\right)^{2}$
$\displaystyle=\frac{1}{\phi((y/l)^{2})}\sum_{\chi}\left\lvert\sum_{r=1}^{X/l^{2}}F(rl^{2})\overline{\chi}(r)-E_{0}(\chi)X\right\lvert^{2}$
$\displaystyle=\frac{1}{\phi((y/l)^{2})}\sum_{\chi}O(l^{-2}y^{2\epsilon}X^{1+2\epsilon})$
$\displaystyle=O(l^{-2}y^{2\epsilon}X^{1+2\epsilon}).$

where the second to last inequality is by Lemma 6.3. Thus, plugging this into
Equation 6.1, we get the bound

$(N-M)^{1/2}\bigg{\lceil}\frac{N-M}{(y/l)^{2}}\bigg{\rceil}^{1/2}y^{\epsilon}X^{1/2+\epsilon}l^{-1}=\begin{cases}O(l^{-1}(N-M)^{1/2}y^{2\epsilon}X^{1/2+\epsilon})&N-M\leq(y/l)^{2}\\\
O(\frac{N-M}{y}y^{2\epsilon}X^{1/2+\epsilon})&\text{ otherwise}\end{cases}$

∎

For the next steps, we need a bound on the main term, specifically
$\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)$.

######  Lemma 6.5.

Let
$\chi_{\operatorname{triv}}\in\widehat{({\mathbb{Z}}/(y/l)^{2}{\mathbb{Z}})}$
be the trivial character. Then,

$\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)=O(\frac{\prod_{p|l,p\equiv
1\mod 4}(2v_{p}(l)+1)}{l^{2}})$

###### Proof.

Since

$L^{l}(\chi_{\operatorname{triv}},s)=\zeta_{{\mathbb{Q}}[i]}(s)l^{-2s}\prod_{p|l,p\equiv
1\mod 4}Q_{\chi_{\operatorname{triv}},l,p}(s),$

the residue at $s=1$ is

$(\operatorname{Res}_{s=1}\zeta_{Q[i]}(s))\prod_{p|l,p\equiv 1\mod
4}Q_{\chi_{\operatorname{triv}},l,p}(1)$

which by the class number formula is

$\frac{\pi}{l^{2}}\prod_{p|l,p\equiv 1\mod
4}Q_{\chi_{\operatorname{triv}},l,p}(1).$

Finally, we have

$\displaystyle|Q_{\chi_{triv},l,p}(1)|$
$\displaystyle=\left|\frac{\sum_{i=0}^{\infty}(2v_{p}(l)+1+i)\chi_{triv}(p^{i})/p^{i}}{\sum_{i=0}^{\infty}(i+1)\chi_{triv}(p^{i})/p^{i}}\right|$
$\displaystyle=\frac{\left|\sum_{i=0}^{\infty}(2v_{p}(l)+1+i)\chi_{triv}(p^{i})/p^{i}\right|}{\left|\sum_{i=0}^{\infty}(i+1)\chi_{triv}(p^{i})/p^{i}\right|}$
$\displaystyle\leq(2v_{p}(l)+1)\frac{\left|\sum_{i=0}^{\infty}(i+1)\chi_{triv}(p^{i})/p^{i}\right|}{\left|\sum_{i=0}^{\infty}(i+1)\chi_{triv}(p^{i})/p^{i}\right|}$
$\displaystyle=2v_{p}(l)+1$

Taking the product over $p|l$ and $p\equiv 1\mod 4$, we obtain our bound.

∎

We will also need the following technical lemma.

######  Lemma 6.6 (Erdos-Turan inequality).

Fix $y$ and $l|y$. Let $i,j\in[0,y)$ be any real number. Then,

$\\#\\{c\in[i,j]:l|c,(c/l,y/l)=1\\}=\frac{\phi(y/l)}{y}(j-i)+O(\sqrt{\phi(y/l)}).$

###### Proof.

This is an application of the Erdos-Turan inequality to the probability
measure $\mu$ on $[0,1)$ given by $\mu(S)=\frac{1}{\phi(y/l)}\\#\\{x\in
S:yx\in{\mathbb{Z}},l|yx,(yx/l,y/l)=1\\}$. ∎

###  6.1 $c\leq(By)^{1/3}$

In this subsection, we wish to bound

$\sum_{(r,c)\in R_{y},c\leq(By)^{1/3}}F(r).$

Fix $c\leq(By)^{1/3}$. Then, the bound $(r+c^{2})\sqrt{|r-c^{2}|}\leq By$
implies that $r\leq 2(By)^{2/3}$. Thus,

$R_{y}\cap\\{(r,c)|c\leq B^{1/3}\\}\subset\\{(r,c)|c\leq B^{1/3},r\leq
B^{2/3},y^{2}|r-c^{2},r-c^{2}\neq 0\\}.$

So,

$\sum_{(r,c)\in
R_{y},c\leq(By)^{1/3}}F(r)\leq\sum_{c=1}^{(By)^{1/3}}\sum_{r=1,r\equiv
c^{2}\mod y^{2}}^{2(By)^{2/3}}F(r).$

######  Lemma 6.7.

Assuming GRH, for any $\epsilon>0$, we have

$\sum_{c=1}^{(By)^{1/3}}\sum_{r=1,r\equiv c^{2}\mod
y^{2}}^{2(By)^{2/3}}F(r)=O_{\epsilon}\left(\frac{B}{y}\sum_{l|y}\frac{\prod_{p|l}(2v_{p}(l)+1)}{l}+B^{2/3+\epsilon}y^{-1/3+\epsilon}+(By)^{1/2+\epsilon}\right).$

###### Proof.

First we split our sum by $(c,y)$.

$\sum_{c=1}^{(By)^{1/3}}\sum_{r=1,r\equiv c^{2}\mod
y^{2}}^{2(By)^{2/3}}F(r)=\sum_{l|y}\sum_{c=1,(c,y)=l}^{(By)^{1/3}}\sum_{r=1,r\equiv
c^{2}\mod
y^{2}}^{2(By)^{2/3}}F(r)=\sum_{l|y}\sum_{c=1,(c,y)=l}^{(By)^{1/3}}\sum_{\begin{subarray}{c}r=1\\\
r\equiv(c/l)^{2}\mod(y/l)^{2}\end{subarray}}^{2(By)^{2/3}/l^{2}}F(rl^{2})$

Now we may apply Proposition 6.1 and obtain

$\sum_{l|y}\sum_{c=1,(c,y)=l}^{(By)^{1/3}}\frac{2(By)^{2/3}}{\phi(y^{2}/l^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)+\sum_{l|y}\begin{cases}O(l^{-1}((By)^{1/3})^{1/2}y^{2\epsilon}(By)^{1/3+\epsilon})&(By)^{1/3}\leq(y/l)^{2}\\\
O(\frac{(By)^{1/3}}{y}y^{2\epsilon}(By)^{1/3+\epsilon})&\text{
otherwise}\end{cases}$
$=\sum_{l|y}\frac{2(By)^{2/3}}{\phi(y^{2}/l^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\sum_{c=1,(c,y)=l}^{(By)^{1/3}}1+\sum_{l|y}\begin{cases}O((By)^{1/2+\epsilon}l^{-1})&(By)^{1/3}\leq(y/l)^{2}\\\
O(B^{2/3+\epsilon}y^{-1/3+\epsilon})&\text{ otherwise}\end{cases}$ $=A+E$

where

$A=\sum_{l|y}\frac{2(By)^{2/3}}{\phi(y^{2}/l^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)\sum_{c=1,(c,y)=l}^{(By)^{1/3}}1$

and

$E=\sum_{l|y}\begin{cases}O((By)^{1/2+\epsilon}l^{-1})&(By)^{1/3}\leq(y/l)^{2}\\\
O(B^{2/3+\epsilon}y^{-1/3+\epsilon})&\text{ otherwise}\end{cases}.$

We first find the bound for the main term $A$. By Lemma 6.5, we get a bound on
$\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)$ of
$\frac{\prod_{p|l,p\equiv 1\mod 4}(2v_{p}(l)+1)}{l^{2}}$, and by Lemma 6.6, we
get that there are $(By)^{1/3}\frac{\phi(y/l)}{y}+O(\sqrt{\phi(y/l)})$ terms
in the sum over $c$. Now in our case, we have $y<B^{5/19}<\sqrt{B}$, and so
$B^{-1/3}y^{2/3}\leq 1\leq\sqrt{\phi(y/l)}$. Rearranging the terms, we get
$\sqrt{\phi(y/l)}\leq(By)^{1/3}\frac{\phi(y/l)}{y},$ and so the number of
terms in the sum over $c$ is at most $O((By)^{1/3}\frac{\phi(y/l)}{y})$. Thus,
we have that

$\displaystyle A$
$\displaystyle=O\left(\sum_{l|y}\frac{2(By)^{2/3}}{\phi(y^{2}/l^{2})}\frac{\prod_{p|l,p\equiv
1\mod 4}(2v_{p}(l)+1)}{l^{2}}(By)^{1/3}\frac{\phi(y/l)}{y}\right)$
$\displaystyle=O\left(\frac{B}{y}\sum_{l|y}\frac{\prod_{p|l}(2v_{p}(l)+1)}{l}\right),$

where in the second equality, for the sake of an upper bound, we forget the
restriction that $p\equiv 1\mod 4$.

Now we estimate $E$.

$\displaystyle E$
$\displaystyle=\sum_{l|y}\begin{cases}O((By)^{1/2+\epsilon}l^{-1})&(By)^{1/3}\leq(y/l)^{2}\\\
O(B^{2/3+\epsilon}y^{-1/3+\epsilon})&\text{ otherwise}\end{cases}$
$\displaystyle=\sum_{l|y,l\leq
B^{-1/6}y^{5/6}}O_{\epsilon}((By)^{1/2+\epsilon}l^{-1})+\sum_{l|y,l>B^{-1/6}y^{5/6}}O_{\epsilon}(B^{2/3+\epsilon}y^{-1/3+\epsilon})$
$\displaystyle=O_{\epsilon}((By)^{1/2+2\epsilon}+B^{2/3+\epsilon}y^{-1/3+2\epsilon})$

∎

###  6.2 $(By)^{1/3}\leq c\leq\frac{B^{1/2-\delta}}{y^{3/10}}$

In this subsection, we wish to bound

$\sum_{\begin{subarray}{c}(r,c)\in R_{y}\\\ (By)^{1/3}\leq c\leq
B^{1/2-\delta}/y^{3/10}\end{subarray}}F(r).$

For $c$ in this range, we will bound the size of $r$. Recall that the set in
question is

$R_{y}=\\{(r,c):(r+c^{2})\sqrt{|r-c^{2}|}\leq By,y^{2}|r-c^{2},r-c^{2}\neq
0\\},$

where we will delay our choice of $\delta$ until the end of this section.

######  Lemma 6.8.

Fix any $c$. Suppose $r>c^{2}$. Then, $(r+c^{2})\sqrt{|r-c^{2}|}\leq By$
implies that $r\geq c^{2}-\frac{(By)^{2}}{c^{4}}$ and $r\leq
c^{2}+\frac{(By)^{2}}{c^{4}}$.

###### Proof.

For the lower bound, we have

$c^{2}\sqrt{c^{2}-r}\leq(r+c^{2})\sqrt{|r-c^{2}|}\leq By.$

Thus, $c^{4}(c^{2}-r)\leq(By)^{2}$. Thus, $r\geq c^{2}-\frac{(By)^{2}}{c^{4}}$

For the upper bound, we assume $r>c^{2}$. Thus, we have
$2c^{2}\sqrt{r-c^{2}}\leq(r+c^{2})\sqrt{|r-c^{2}|}\leq By$. Hence
$4c^{4}(r-c^{2})\leq(By)^{2}$. Thus, $r\leq c^{2}+\frac{(By)^{2}}{4c^{4}}$. In
particular, $r\leq c^{2}+\frac{(By)^{2}}{c^{4}}$. ∎

From this lemma, we see that

$\sum_{\begin{subarray}{c}(r,c)\in R_{y}\\\ (By)^{1/3}\leq c\leq
B^{1/2-\delta}/y^{3/10}\end{subarray}}F(r)\leq\sum_{c=(By)^{1/3}}^{B^{1/2-\delta}/y^{3/10}}\sum_{\begin{subarray}{c}r=c^{2}-\frac{(By)^{2}}{c^{4}}\\\
r\equiv c^{2}\mod y^{2}\end{subarray}}^{c^{2}+\frac{(By)^{2}}{c^{4}}}F(r).$

Thus, it will suffice to bound the double sum.

######  Lemma 6.9.

Assuming GRH, for any $\epsilon\geq\delta>0$, we have

$\sum_{c=(By)^{1/3}}^{B^{1/2-\delta}/y^{3/10}}\sum_{\begin{subarray}{c}r=c^{2}-\frac{(By)^{2}}{c^{4}}\\\
r\equiv c^{2}\mod
y^{2}\end{subarray}}^{c^{2}+\frac{(By)^{2}}{c^{4}}}F(r)=O_{\epsilon,\delta}(\frac{B}{y}\sum_{l|y}\frac{1}{l}\prod_{p|l}(2v_{p}(l)+1)+B^{1-2\delta+\epsilon}y^{-1+3\epsilon}).$

###### Proof.

We again have to use Proposition 6.1 to obtain a good bound. We will split our
summation over $c$ in two ways. We first split it by $(c,y)$, then we split
into small intervals as in the black rectangles in Figure 1. Let
$n_{i}=(By)^{1/3}+iy^{4/5}$. Then, we have

$\sum_{c=(By)^{1/3}}^{B^{1/2-\delta}/y^{3/10}}\sum_{\begin{subarray}{c}r=c^{2}-\frac{(By)^{2}}{c^{4}}\\\
r\equiv c^{2}\mod
y^{2}\end{subarray}}^{c^{2}+\frac{(By)^{2}}{c^{4}}}F(r)=\sum_{l|y}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}-1}\sum_{c=n_{i},(c,y)=l}^{n_{i+1}}\sum_{\begin{subarray}{c}r=c^{2}-\frac{(By)^{2}}{c^{4}}\\\
r\equiv c^{2}\mod y^{2}\end{subarray}}^{c^{2}+\frac{(By)^{2}}{c^{4}}}F(r)$

Now for each interval, we upper bound the sum as follows.

$\sum_{c=n_{i},(c,y)=l}^{n_{i+1}}\sum_{\begin{subarray}{c}r=c^{2}-\frac{(By)^{2}}{c^{4}}\\\
r\equiv c^{2}\mod
y^{2}\end{subarray}}^{c^{2}+\frac{(By)^{2}}{c^{4}}}F(r)\leq\sum_{c=n_{i},(c,y)=l}^{n_{i+1}}\sum_{\begin{subarray}{c}r=n_{i}^{2}-\frac{(By)^{2}}{n_{i}^{4}}\\\
r\equiv c^{2}\mod
y^{2}\end{subarray}}^{n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}}}F(r)=\sum_{c=n_{i},(c,y)=l}^{n_{i+1}}\sum_{\begin{subarray}{c}r=(n_{i}^{2}-\frac{(By)^{2}}{n_{i}^{4}})/l^{2}\\\
r\equiv(c/l)^{2}\mod(y/l)^{2}\end{subarray}}^{(n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})/l^{2}}F(rl^{2}).$

We may use Corollary 6.1 on this sum, and get

$\sum_{c=n_{i},(c,y)=l}^{n_{i+1}}\frac{1}{\phi(y^{2}/l^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)((n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})-(n_{i}^{2}+\frac{(By)^{2}}{n_{i}^{4}}))$
$+\begin{cases}O(\frac{1}{l}(y^{4/5})^{1/2}y^{\epsilon}(n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})^{1/2+\epsilon})&y^{4/5}\leq(y/l)^{2}\\\
O(\frac{y^{4/5}}{y}y^{\epsilon}(n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})^{1/2+\epsilon})&\text{
otherwise}\end{cases}=A_{i,l}+E_{i,l}$

where

$A_{i,l}:=\sum_{c=n_{i},(c,y)=l}^{n_{i+1}}\frac{1}{\phi(y^{2}/l^{2})}\operatorname{Res}_{s=1}L^{l}(\chi_{\operatorname{triv}},s)((n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})-(n_{i}^{2}+\frac{(By)^{2}}{n_{i}^{4}}))$

and

$E_{i,l}=\begin{cases}O(\frac{1}{l}(y^{4/5})^{1/2}y^{\epsilon}(n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})^{1/2+\epsilon}))&y^{4/5}\leq(y/l)^{2}\\\
O(\frac{y^{4/5}}{y}y^{\epsilon}(n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})^{1/2+\epsilon})&\text{
otherwise}\end{cases}$

$\chi_{\operatorname{triv}}$ is the trivial character in
$\widehat{({\mathbb{Z}}/(y/l)^{2}{\mathbb{Z}})^{\times}}$.

Now our main term will be $\sum_{l}\sum_{i}A_{i,l}$, and our error term will
be $\sum_{l}\sum_{i}E_{i,l}$. Lemma 6.5 gives us an estimate on the residue of
$L^{l}(\chi_{\operatorname{triv}},s)$ and Lemma 6.6 gives us an estimate on
the number of terms in the summation over $c$. Thus, we obtain

$\displaystyle A_{i,l}=O\Bigg{(}$
$\displaystyle\left((n_{i+1}-n_{i})\frac{\phi(y/l)}{y}+\sqrt{\phi(y/l)}\right)\frac{1}{\phi(y^{2}/l^{2})}\frac{\prod_{p|l,p\equiv
1\mod 4}(2v_{p}(l)+1)}{l^{2}}$
$\displaystyle((n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})-(n_{i}^{2}-\frac{(By)^{2}}{n_{i}^{4}}))\Bigg{)}.$

For the sake of an upper bound, we may forget the restriction of $p\equiv
1\mod 4$ in the product. Next, substituting $n_{i}=(By)^{1/3}+iy^{4/5}$ and
simplifying, we obtain

$\displaystyle A_{i,l}=O\Bigg{(}$
$\displaystyle\left(\frac{\phi(y/l)}{y^{1/5}}+\sqrt{\phi(y/l)}\right)\frac{1}{\phi(y^{2}/l^{2})}\frac{\prod_{p|l}(2v_{p}(l)+1)}{l^{2}}$
$\displaystyle(y^{4/5}(By)^{1/3}+(i+1)y^{8/5}+\frac{(By)^{2}}{((By)^{1/3}+iy^{4/5})^{4}})\Bigg{)}.$

Summing over $i$, we get that

$\displaystyle\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}A_{i,l}$
$\displaystyle=O\Bigg{(}\left(\frac{\phi(y/l)}{y^{1/5}}+\sqrt{\phi(y/l)}\right)\frac{1}{\phi(y^{2}/l^{2})}\frac{\prod_{p|l}(2v_{p}(l)+1)}{l^{2}}$
$\displaystyle((B^{1/2-\delta}/y^{11/10})y^{4/5}(By)^{1/3}+(B^{1/2-\delta}/y^{11/10})^{2}y^{8/5}+\frac{(By)^{2}}{y^{4/5}((By)^{1/3})^{3}})\Bigg{)}$
$\displaystyle=O\left(\left(\frac{\phi(y/l)}{y^{1/5}}+\sqrt{\phi(y/l)}\right)\frac{1}{\phi(y^{2}/l^{2})}\frac{\prod_{p|l}(2v_{p}(l)+1)}{l^{2}}(B^{5/6}y^{1/30}+B^{1/2}y^{-3/5}+By^{1/5})\right)$
$\displaystyle=O\left(\left(\frac{\phi(y/l)}{y^{1/5}}+\sqrt{\phi(y/l)}\right)\frac{1}{\phi(y^{2}/l^{2})}\frac{\prod_{p|l}(2v_{p}(l)+1)}{l^{2}}By^{1/5}\right)$
$\displaystyle=O\left(\frac{B}{yl}\prod_{p|l}(2v_{p}(l)+1)+\frac{\sqrt{(y/l)\prod_{p|(y/l)}(1-1/p)}}{y^{4/5}}\frac{\prod_{p|l}(2v_{p}(l)+1)B}{y\prod_{p|(y/l)}(1-1/p)}\right)$
$\displaystyle=O\left(\frac{B}{yl}\prod_{p|l}(2v_{p}(l)+1)+\frac{B}{y^{13/10}l^{1/2}}\prod_{p|l}(2v_{p}(l)+1)\right)$

It remains to sum over $l|y$. For the first term, we leave it as

$\frac{B}{y}\sum_{l|y}\frac{1}{l}\prod_{p|l}(2v_{p}(l)+1).$

For the second term, we have

$\sum_{l|y}\frac{B}{y^{13/10}l^{1/2}}\prod_{p|l}(2v_{p}(l)+1)=O_{\epsilon}(\frac{B}{y^{13/10}}\sum_{l|y}l^{-1/2+\epsilon})=O_{\epsilon}(By^{-13/10+\epsilon}),$

which is smaller than our first term. Thus, all in all, we obtain as our main
term

$\sum_{l|y}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}A_{i,l}=O(\frac{B}{y}\sum_{l|y}\frac{1}{l}\prod_{p|l}(2v_{p}(l)+1)).$

We now estimate the error term. First we have the estimate

$\displaystyle(n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})^{1/2}$
$\displaystyle\leq n_{i+1}+\frac{By}{n_{i+1}^{2}}$
$\displaystyle=(By)^{1/3}+iy^{4/5}+\frac{By}{((By)^{1/3}+iy^{4/5})^{2}}$
$\displaystyle\leq 2(By)^{1/3}+iy^{4/5}.$

Similarly, it is quick to see that
$(n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})^{\epsilon}\leq(By)^{\epsilon}$.
So,

$\displaystyle\sum_{l|y}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}E_{i,l}$
$\displaystyle=\sum_{l|y,l\leq
y^{3/5}}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}E_{i,l}+\sum_{l|y,l>y^{3/5}}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}E_{i,l}$
$\displaystyle=\sum_{l|y,l\leq
y^{3/5}}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}O_{\epsilon}(l^{-1}y^{2/5+\epsilon}(n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})^{1/2+\epsilon})$
$\displaystyle+\sum_{l|y,l>y^{3/5}}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}O_{\epsilon}(y^{-1/5+\epsilon}(n_{i+1}^{2}+\frac{(By)^{2}}{n_{i+1}^{4}})^{1/2+\epsilon})$
$\displaystyle=\sum_{l|y,l\leq
y^{3/5}}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}O_{\epsilon}(l^{-1}y^{2/5+\epsilon}((By)^{1/3}+iy^{4/5})(By)^{\epsilon})$
$\displaystyle+\sum_{l|y,l>y^{3/5}}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}O_{\epsilon}(y^{-1/5+\epsilon}((By)^{1/3}+iy^{4/5})(By)^{\epsilon})$
$\displaystyle=\sum_{l|y,l\leq
y^{3/5}}O_{\epsilon}(l^{-1}B^{\epsilon}y^{2/5+2\epsilon}((By)^{1/3}+\frac{B^{1/2-\delta}}{y^{3/10}})(\frac{B^{1/2-\delta}}{y^{11/10}}))$
$\displaystyle+\sum_{l|y,l>y^{3/5}}O_{\epsilon}(B^{\epsilon}y^{-1/5+2\epsilon}((By)^{1/3}+\frac{B^{1/2-\delta}}{y^{3/10}})(\frac{B^{1/2-\delta}}{y^{11/10}}))$

Now on the regime we are considering, $y\leq B^{5/19-\epsilon}$. This is
exactly equivalent to $(By)^{1/3}\leq\frac{B^{1/2-\epsilon}}{y^{3/10}}$. Now,
since we are choosing $\delta\leq\epsilon$, we see that
$(By)^{1/3}\leq\frac{B^{1/2-\delta}}{y^{3/10}}$. Thus,

$\displaystyle
O_{\epsilon}(l^{-1}B^{\epsilon}y^{2/5+2\epsilon}((By)^{1/3}+\frac{B^{1/2-\delta}}{y^{3/10}})(\frac{B^{1/2-\delta}}{y^{11/10}}))$
$\displaystyle=O_{\epsilon}(l^{-1}B^{\epsilon}y^{2/5+2\epsilon}(\frac{B^{1/2-\delta}}{y^{3/10}})(\frac{B^{1/2-\delta}}{y^{11/10}}))$
$\displaystyle=O_{\epsilon}(l^{-1}B^{1-2\delta+\epsilon}y^{-1+2\epsilon}).$

Similarly,

$O_{\epsilon}(B^{\epsilon}y^{-1/5+2\epsilon}((By)^{1/3}+\frac{B^{1/2-\delta}}{y^{3/10}})(\frac{B^{1/2-\delta}}{y^{11/10}}))=O_{\epsilon}(B^{1-2\delta+\epsilon}y^{-8/5+2\epsilon})$

With this, we continue our bound and obtain

$\displaystyle\sum_{l|y}\sum_{i=0}^{B^{1/2-\delta}/y^{11/10}}E_{i,l}$
$\displaystyle=\sum_{l|y,l\leq
y^{3/5}}O_{\epsilon}(l^{-1}B^{1-2\delta+\epsilon}y^{-1+2\epsilon})+\sum_{l|y,l>y^{3/5}}O_{\epsilon}(B^{1-2\delta+\epsilon}y^{-8/5+2\epsilon})$
$\displaystyle=O_{\epsilon}(B^{1-2\delta+\epsilon}y^{-1+3\epsilon})$

∎

###  6.3 $\frac{B^{1/2-\delta}}{y^{3/10}}\leq c\leq B^{1/2}$

In this range, we may use a trivial estimate.

######  Lemma 6.10.

Assuming GRH, for all $\epsilon,\delta>0$,

$\sum_{\begin{subarray}{c}(r,c)\in R_{y}\\\
\frac{B^{1/2-\delta}}{y^{3/10}}\leq c\leq
B^{1/2}\end{subarray}}F(r)=O_{\epsilon}(B^{1/2+\epsilon+3\delta}y^{9/10})$

###### Proof.

$\displaystyle\sum_{\begin{subarray}{c}(r,c)\in R_{y}\\\
\frac{B^{1-\delta}}{y^{3/10}}\leq c\leq B^{1/2}\end{subarray}}F(r)$
$\displaystyle\leq\sum_{\frac{B^{1/2-\delta}}{y^{3/10}}\leq c\leq
B^{1/2}}\sum_{\begin{subarray}{c}r=c^{2}-\frac{(By)^{2}}{c^{4}}\\\ r\equiv
c^{2}\mod y^{2}\end{subarray}}^{c^{2}+\frac{(By)^{2}}{c^{4}}}F(r)$
$\displaystyle\leq\sum_{\frac{B^{1/2-\delta}}{y^{3/10}}\leq c\leq
B^{1/2}}\sum_{\begin{subarray}{c}r=c^{2}-\frac{(By)^{2}}{c^{4}}\\\ r\equiv
c^{2}\mod
y^{2}\end{subarray}}^{c^{2}+\frac{(By)^{2}}{c^{4}}}O_{\epsilon}(B^{\epsilon})$
$\displaystyle\leq\sum_{\frac{B^{1/2-\delta}}{y^{3/10}}<c\leq
B^{1/2}}O_{\epsilon}(B^{\epsilon})\lceil\frac{B^{2}}{c^{4}}\rceil$
$\displaystyle=O_{\epsilon}(B^{1/2+\epsilon+3\delta}y^{9/10})$

∎

###  6.4 Proof of Proposition 3.10

Now we may prove our proposition.

###### Proof of Proposition 3.10.

By lemmas 6.7, 6.9, and 6.10, we have that

$|S_{y}^{\prime}|=O_{\epsilon_{0},\delta}(\frac{B}{y}\sum_{l|y}\frac{1}{l}\prod_{p|l}(2v_{p}(l)+1)+B^{1-2\delta+\epsilon_{0}}y^{-1+3\epsilon_{0}}+(By)^{1/2+\epsilon_{0}}+B^{2/3+\epsilon_{0}}y^{-1/3+\epsilon_{0}}+B^{1/2+\epsilon_{0}+3\delta}y^{9/10}),$

for any $\epsilon_{0}\geq\delta>0$. We now make our choice of $\delta$ and
$\epsilon_{0}$ to be $\epsilon/4$. Then, we may sum these terms over $y\leq
B^{5/19-\epsilon}$ and obtain that all terms are $O(B)$ except for the first
term, which we will now examine.

We want to bound

$\sum_{y=1}^{B^{5/19-\epsilon}}\frac{B}{y}\sum_{l|y}\frac{1}{l}\prod_{p|l}(2v_{p}(l)+1).$

It suffices to show

$\sum_{y=1}^{B}\frac{1}{y}\sum_{l|y}\frac{1}{l}\prod_{p|l}(2v_{p}(l)+1)=O(\log
B).$

Now we have the bound

$\displaystyle\sum_{y=1}^{B}\frac{1}{y}\sum_{l|y}\frac{1}{l}\prod_{p|l}(2v_{p}(l)+1)$
$\displaystyle\leq\sum_{y=1,\exists p\leq
B,p|y}^{\infty}\frac{1}{y}\sum_{l|y}\frac{1}{l}\prod_{p|l}(2v_{p}(l)+1)$
$\displaystyle=\prod_{p\leq
B}\left(1+\frac{1+\frac{3}{p}}{p}+\frac{1+\frac{3}{p}+\frac{5}{p^{2}}}{p^{2}}+\dots\right).$

Let

$M=1+\frac{3}{2}+\frac{5}{2^{2}}+\frac{7}{2^{3}}+\dots.$

Then, the Euler product is bounded by

$\displaystyle\prod_{p\leq
B}\left(1+\frac{1}{p}+\frac{3}{p^{2}}+\frac{M}{p^{2}}+\frac{M}{p^{3}}+\dots\right)$
$\displaystyle=O(\prod_{p\leq B}(1+\frac{1}{p}))$
$\displaystyle=e^{\sum_{p\leq B}\log(1+1/p)+O(1)}$
$\displaystyle=e^{\sum_{p\leq B}\frac{1}{p}+O(1)}$
$\displaystyle=O(e^{\log\log B})$ $\displaystyle=O(\log B).$

∎

##  7 Lower Bound

The goal of this section is to prove Proposition 7.5. Recall

$T:=\\{(a,b,c):\gcd(a,b)=1,\max(|a|,|b|,|c|)^{2}\sqrt{x}\leq
B,a^{2}+b^{2}\equiv 5\mod 8,$ $\operatorname{sqf}(a^{2}+b^{2}-c^{2})\equiv
b\equiv 0\mod 2\\}.$

We will lower bound $|T|$ by splitting it up into pieces, as follows. Define
$T_{x}=\\{(a,b,c)\in T:\operatorname{sqf}(a^{2}+b^{2}-c^{2})=x\\}$, so that
$\bigsqcup_{x=2}^{B^{2/3-\epsilon}}T_{x}\subset T$ for any $\epsilon>0$. Also
define $F^{\prime}(n)$ to be the number of ways $n$ may be written as a sum of
two coprime squares. Then,

$|T_{x}|=\frac{1}{2}\sum_{n=1}^{2B/\sqrt{x}}F^{\prime}(n)G_{x}(n)$

where $1/2$ comes from the fact that in every representation of $n$ as a sum
of two coprime squares, one of them is even and one of them is odd but we
require $b$ to be the even one.

To analyze $|T_{x}|$, we will consider the following $L$-function,

$L_{x,lower}=\sum_{n=1}^{\infty}\frac{a_{n}}{n^{s}},$

where $a_{n}=\begin{cases}F^{\prime}(n)G_{x}(n)&n\equiv 5\mod 8\\\ 0&\text{
otherwise}\end{cases}$. Note that this $L$-function is extremely similar to
$L_{x}(s)$, and so we will apply the same process to $L_{x,lower}$. Let
$\widehat{({\mathbb{Z}}/8{\mathbb{Z}})^{\times}}$ denote the characters on the
multiplicative group of ${\mathbb{Z}}/8{\mathbb{Z}}$. Then,

$L_{x,lower}(s)=\frac{1}{|({\mathbb{Z}}/8{\mathbb{Z}})^{\times}||\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])|}\sum_{\begin{subarray}{c}\chi_{1}\in\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}\\\
\chi_{2}\in\widehat{({\mathbb{Z}}/8{\mathbb{Z}})^{\times}}\end{subarray}}\chi_{2}(5)L_{0,lower}(\chi_{1}\chi_{2},s)$

where

$\displaystyle L_{0,lower}(\chi,s)=$ $\displaystyle\prod_{p\in
P_{1,1}}\left(1+\frac{2\chi(\pi)}{p^{s}}+\frac{2\chi(\bar{\pi})}{p^{s}}+\frac{2\chi(\pi^{2})}{p^{2s}}+\frac{2\chi(\bar{\pi}^{2})}{p^{2s}}+\dots\right)$
$\displaystyle\prod_{p\in
P_{1,0}}\left(1+\frac{2\chi(p)}{p^{2s}}+\frac{2\chi(p^{2})}{p^{4s}}+\dots\right)$
$\displaystyle\prod_{p\in
P_{1,ram}}\left(1+\frac{2\chi(\pi)}{p^{s}}+\frac{2\chi(\pi^{2})}{p^{2s}}+\dots\right).$

Here we make the abuse of notation for $\chi_{2}$, so that $\chi_{2}(\pi)$ is
defined by $\chi_{2}(N(\pi))$.

Now we may estimate $L_{x,lower}(s)$ just as we did for $L_{x}(s)$. We give a
meromorphic continuation with poles at $s=1$, we find the residue, and then we
bound the size of $L_{x,lower}(s)$ near $\Re(s)=1/2$ in order to apply the
Tauberian theorem. Instead of carrying out the same calculations again, we
will state the relevant analogous lemmas.

Define
$\chi_{\operatorname{triv},\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}}$
to be the trivial character in
$\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}$. Define
$\chi_{\operatorname{triv},\widehat{({\mathbb{Z}}/8{\mathbb{Z}})^{\times}}}$
to be the trivial character in
$\widehat{({\mathbb{Z}}/8{\mathbb{Z}})^{\times}}$ and
$\chi_{im,\widehat{({\mathbb{Z}}/8{\mathbb{Z}})^{\times}}}$ to be the
“imaginary” character (which takes values $1$ for $1,5\mod 8$, and $-1$ for
$3,7\mod 8$). Also, recall $\chi_{x}$ was defined to be the character
associated to the Jacobi Symbol $\chi_{x}(n)=\left(\frac{x}{n}\right)$.

######  Lemma 7.1.

$L_{x,lower}(s)$ may be meromorphically continued to $\Re(s)>1/2$, with a
simple pole of $s=1$ of residue

$\displaystyle\frac{1}{4|\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])|}$
$\displaystyle(\operatorname{Res}_{s=1}L_{0,lower}(\chi_{\operatorname{triv},\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}}\chi_{\operatorname{triv},\widehat{({\mathbb{Z}}/8{\mathbb{Z}})^{\times}}},s)$
$\displaystyle+\operatorname{Res}_{s=1}L_{0,lower}(\chi_{\operatorname{triv},\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}}\chi_{im,\widehat{({\mathbb{Z}}/8{\mathbb{Z}})^{\times}}},s)).$

###### Proof.

This follows the same proof as Lemma 4.1. ∎

######  Lemma 7.2.

Both

$\operatorname{Res}_{s=1}L_{0,lower}(\chi_{\operatorname{triv},\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}}\chi_{\operatorname{triv},\widehat{({\mathbb{Z}}/8{\mathbb{Z}})^{\times}}},s)$

and

$\operatorname{Res}_{s=1}L_{0,lower}(\chi_{\operatorname{triv},\widehat{\operatorname{Cl}({\mathbb{Q}}[\sqrt{-x}])}}\chi_{im,\widehat{({\mathbb{Z}}/8{\mathbb{Z}})^{\times}}},s)$

are

$\Omega(\frac{L(\chi_{x}\chi_{-1},1)L(\chi_{x},1)}{\sqrt{x}})$

###### Proof.

This follows the same proof as Lemma 4.2, noting that for the sake of a lower
bound, we may ignore local factors of ramified primes. ∎

######  Proposition 7.3.

Assuming GRH, for all $\epsilon>0$,

$\sum_{n=1}^{X}F^{\prime}(n)G_{x}(n)=X\operatorname{Res}_{s=1}L_{x,lower}(s)+O_{\epsilon}(X^{1/2+\epsilon}x^{\epsilon})$

###### Proof.

This follows the same proof as Proposition 4.3, noting that for the sake of a
lower bound, we may ignore local factors of ramified primes. ∎

######  Corollary 7.4.

Assuming GRH,

$|T_{x}|=\Omega_{\epsilon}(B\frac{L(\chi_{x},1)}{x}+B^{1/2+\epsilon}x^{-1/4+\epsilon}).$

###### Proof.

Combine Lemma 7.2 and Proposition 7.3, and apply it to the case where
$X=\frac{B}{\sqrt{x}}$. ∎

From the Corollary, we get

######  Proposition 7.5.

$|T|=\Omega(B\log B)$.

###### Proof.

Since $\bigsqcup_{2\leq x\leq B^{2/3-\epsilon}}T_{x}\subset T$, we have that

$\displaystyle|T|$ $\displaystyle\geq\sum_{\begin{subarray}{c}2\leq x\leq
B^{2/3-\epsilon}\\\ \text{ even, squarefree}\end{subarray}}|T_{x}|$
$\displaystyle=\sum_{\begin{subarray}{c}2\leq x\leq B^{2/3-\epsilon}\\\ \text{
even,
squarefree}\end{subarray}}\Omega_{\delta}(B\frac{L(\chi_{x},1)}{x}+B^{1/2+\delta}x^{-1/4+\delta}).$

Taking $\delta=\frac{9}{20}\epsilon$, the second term becomes $O(B)$. For the
first term, we do summation by parts, and obtain

$B\left(O(1)+\sum_{k\leq B^{2/3-\epsilon}}\frac{\sum_{\begin{subarray}{c}x\leq
k\\\ \text{ even, squarefree}\end{subarray}}L(\chi_{x},1)}{k(k+1)}\right).$
(7.1)

So, it suffices to show

$\sum_{\begin{subarray}{c}x\leq k\\\ \text{ even,
squarefree}\end{subarray}}L(\chi_{x},1)$

is at least on the order of $k$. The proof of this is almost exactly the same
as the proof outlined in [1, Theorem V.5.3], and so we omit it.

∎

##  8 Appendix A

The following appendix almost follows word for word [4, Appendix A]. The only
difference is that we kept track of the error dependence on the L-function.

######  Theorem 8.1.

Let $(\lambda_{n})$ be an increasing sequence of positive real numbers. Let
$(c_{n})$ be a sequence of nonnegative real numbers. Define

$f(s)=\sum_{n=0}^{\infty}\frac{c_{n}}{\lambda_{n}^{s}}.$

We make the following hypotheses

  1. 1.

$f$ converges on the half-plane $\Re(s)>a>0$;

  2. 2.

$f$ admits a meromorphic continuation to $\Re(s)>a-\delta_{0}>0$;

  3. 3.

and on this domain, there is a unique pole at $s=a$, of multiplicity
$b\in{\mathbb{N}}$. We note that $\Theta=\lim_{s\to a}f(s)(s-a)^{b}>0$.

  4. 4.

Finally, we assume there exists positive constants $r,\kappa$ so that

$|f(s)\frac{(s-a)^{b}}{s^{b}}|\leq r(1+\Im(s))^{\kappa}.$

Then, there exists a monic polynomial $P$ of degree $b-1$ so that for
$\delta\leq\delta_{0}$, as $X$ tends to $\infty$, we have

$N(X):=\sum_{\lambda_{n}\leq
X}c_{n}=\frac{\Theta}{a(b-1)!}X^{a}P(\log(X))+O(rX^{a-\delta}).$

We define, for positive integers $k$, the function

$\phi_{k}(X)=\sum_{\lambda_{n}\leq X}a_{n}(\log(X/\lambda_{n}))^{k},$

and define $\phi_{0}(X)=N$.

######  Lemma 8.2.

With the hypothesis of the previous theorem, there exists for integers
$k>\kappa$ a polynomial $Q$ of degree $b-1$ with leading coefficient
$\frac{k!\Theta}{a^{k+1}(b-1)!}$ so that for $\delta<\delta_{0}$, we have

$\phi_{k}(X)=X^{a}Q(\log X)+O(rX^{a-\delta}),$

where the implied constant is independent of $f$.

###### Proof.

For any $a^{\prime}>a$, we have

$\int_{a^{\prime}+i{\mathbb{R}}}\lambda^{s}\frac{ds}{s^{k+1}}=\frac{2\pi
i}{k!}(\log^{+}(\lambda))^{k},\lambda>0.$

Consequently,

$\phi_{k}(X)=\frac{k!}{2\pi
i}\int_{a^{\prime}+i{\mathbb{R}}}f(s)X^{s}\frac{ds}{s^{k+1}},$

where the integral is absolutely convergent as $k>\kappa$.

We now shift the contour of integration to $\Re(s)=a-\delta$. We pick up a
pole at $s=a$ with residue $\frac{\Theta}{a^{k+1}(b-1)!}X^{a}Q(\log X)$, where
$Q$ is a monic polynomial of degree $b-1$. The resulting integral

$\int_{\Re(s)=a-\delta}f(s)X^{s}\frac{ds}{s^{k+1}}$

is an error term, and here we use the bound $|f(s)\frac{(s-a)^{b}}{s^{b}}|\leq
r(1+\Im(s))^{\kappa}$ and obtain that the integral is $O(rX^{a-\delta})$. ∎

Now we may prove Theorem 8.1.

###### Proof.

We prove by inductive descent on $k$ that the previous lemma is in fact true
for all integers $k$. For $k=0$, the theorem is trivially proven. Now assuming
the previous lemma holds for some fixed $k\geq 1$, we show that it is in fact
true for $k-1$.

For any $\eta\in(0,1)$, we have the inequality

$\frac{\phi_{k}(X(1-\eta))-\phi_{k}(X)}{\log(1-\eta)}\leq
k\phi_{k-1}(X)\leq\frac{\phi_{k}(X(1+\eta))-\phi_{k}(X)}{\log(1+\eta)}.$

Now fix $\delta^{\prime}$ with $0<\delta<\delta^{\prime}<\delta_{0}$. By the
previous lemma,

$|\phi_{k}(X)-X^{a}Q(\log X)|=O(rX^{a-\delta^{\prime}}).$

Consequently, for $-1<u<1$,

$\frac{\phi_{k}(X(1+u))-\phi_{k}(X)}{\log(1+u)}=\frac{k!\Theta}{a^{k+1}(b-1)!}X^{a}\frac{Q(\log
X+\log(1+u))(1+u)^{a}-Q(\log X)}{\log(1+u)}+R(X),$

where

$|R(X)|=O(\frac{2rX^{a-\delta^{\prime}}}{|\log(1+u)|})=O(r\frac{X^{a-\delta^{\prime}}}{u}).$

Now we have a series of equalities.

$\displaystyle\frac{Q(\log X+\log(1+u))(1+u)^{a}-Q(\log X)}{\log(1+u)}$
$\displaystyle=Q(\log
X)\frac{(1+u)^{a}-1}{\log(1+u)}+\sum_{n=1}^{b-1}\frac{1}{n!}Q^{(n)}(\log(X))(\log(1+u)^{n-1}(1+u)^{a})$
$\displaystyle=Q(\log X)(a+O(u))+Q^{\prime}(\log(X))(1+O(u))+O((\log
X)^{b-1}u)$ $\displaystyle=(aQ+Q^{\prime})(\log X)+O((\log X)^{b-1}u).$

Take $u=\pm 1/X^{\epsilon}$, where $\delta^{\prime}-\epsilon>\delta$. Then, we
have $|R(X)|=O(rX^{a-\delta})$ and

$\frac{Q(\log X+\log(1+u))(1+u)^{a}-Q(\log X)}{\log(1+u)}=(aQ+Q^{\prime})(\log
X)+O(rX^{-\delta}).$

Thus, we have that $\phi_{k-1}(X)=\frac{1}{k}X^{a}(aQ+Q^{\prime})(\log
X)+O(rX^{a-\delta})$ and the leading coefficient of
$\frac{1}{k}(aQ+Q^{\prime})$ is precisely $\frac{(k-1)!\Theta}{a^{k}(b-1)!}$.
∎

## References

  * [1] Raymond Ayoub  “An Introduction to the Analytic Theory of Numbers”  In _Mathematical Surveys and Monographs_ , 2006  DOI: 10.1090/surv/010
  * [2] Brandon Boggess and Soumya Sankar  “Counting elliptic curves with a rational $N$-isogeny for small $N$”  In _arXiv preprint arXiv:2009.05223_ , 2020
  * [3] Enrico Bombieri and Walter Gubler  “Heights in diophantine geometry”  Cambridge University Press, 2007
  * [4] Antoine Chambert-Loir and Yuri Tschinke  “Fonctions ZÊta Des Hauteurs Des Espaces Fibrés”  In _Progress in Mathematics Rational Points on Algebraic Varieties_ , 2001, pp. 71–115  DOI: 10.1007/978-3-0348-8368-9˙4
  * [5] Ratko Darda and Takehiko Yasuda  “The Batyrev-Manin conjecture for DM stacks”, 2022  arXiv:2207.03645 [math.NT]
  * [6] Jordan S. Ellenberg, Matthew Satriano and David Zureick-Brown  “Heights on stacks and a generalized Batyrev-Manin-Malle conjecture”, 2021  arXiv:2106.11340 [math.NT]
  * [7] Henryk Iwaniec and Emmanuel Kowalski  “Analytic number theory”  American Mathematical Society, 2004
  * [8] Robert J Lemke Oliver and Frank Thorne  “Upper bounds on number fields of given degree and bounded discriminant”  In _Duke Mathematical Journal_ 171.15 Duke University Press, 2022, pp. 3077–3087
  * [9] David Masser and Jeffrey D. Vaaler  “Counting algebraic numbers with large height I”  In _Diophantine Approximation_ , 2008, pp. 237–243  DOI: 10.1007/978-3-211-74280-8˙14
  * [10] Hugh L. Montgomery and Robert C. Vaughan  “Multiplicative number theory”  Cambridge University Press, 2007
  * [11] Brett Nasserden and Stanley Yao Xiao  “The density of rational points on $\mathbb{P}^{1}$ with three stacky points”  In _arXiv.org_ , 2020  URL: https://arxiv.org/abs/2011.06586v1
  * [12] Tristan Phillips  “Rational points of bounded height on genus zero modular curves and average analytic ranks of elliptic curves over number fields”  In _arXiv.org_ , 2022  URL: https://arxiv.org/abs/2201.10624
  * [13] Jeffrey D Vaaler and Martin Widmer  “A note on generators of number fields”  In _Diophantine methods, lattices, and arithmetic theory of quadratic forms_ 587, 2013, pp. 201–211