# Amicable pairs and aliquot cycles on average

James Parks  Department of Mathematics and Computer Science, Lethbridge
University, 4401 University Drive, Lethbridge, AB, T1K 3M4, Canada
<EMAIL_ADDRESS>
###### Abstract.

Silverman and Stange defined the notion of an aliquot cycle of length $L$ for
a fixed elliptic curve $E/\mathbb{Q}$, and conjectured an order of magnitude
for the function that counts such aliquot cycles. We show that the conjectured
upper bound holds for the number of aliquot cycles on average over the family
of all elliptic curves with short bounds on the size of the parameters in the
family.

The author is supported by a PIMS Postdoctoral Fellowship.

##  1\. Introduction

Let $E$ be an elliptic curve defined over $\mathbb{Q}$ and let $L\geq 2$ be a
positive integer. For a prime $p$, let $a_{p}(E)$ denote the trace of the
Frobenius automorphism. Silverman and Stange [SiSt] defined an $L$-tuple
$(p_{1},\ldots,p_{L})$ of distinct prime numbers to be an aliquot cycle of
length $L$ of $E$ if $E$ has good reduction at each prime $p_{i}$ and

$\\#{E}_{p_{i}}(\mathbb{F}_{p_{i}})=p_{i}+1-a_{p_{i}}(E_{p_{i}})=p_{i+1}\quad{\rm
for}\>1\leq i\leq L,$

where we set $p_{L+1}:=p_{1}$. Aliquot cycles of length $L=2$ are called
amicable pairs. These definitions can be interpreted as the elliptic curve
analogues to the classically defined aliquot cycles. As observed in [SiSt,
Remark 1.5] aliquot cycles arose naturally when Silverman and Stange
generalized Smyth’s [Smy] results on index divisibility of Lucas sequences to
elliptic divisibility sequences.

We are interested in the the distribution of aliquot cycles of a given length
$L$ for a fixed elliptic curve $E/\mathbb{Q}$. We define an aliquot cycle
$(p_{1},\ldots,p_{L})$ to be normalized if $p_{1}=\min\\{p_{i}:1\leq i\leq
L\\}$. We consider the normalized aliquot cycle counting function

$\pi_{E,L}(X):=\\#\\{(p_{1},\ldots,p_{L})\>{\rm
is\>a\>normalized\>aliquot\>cycle}\>|\>p_{1}\leq X\\}.$

Silverman and Stange [SiSt] used a heuristic argument to give the following
conjecture for the behavior of $\pi_{E,L}(X)$.

######  Conjecture 1.1 (Silverman-Stange).

Let $E/\mathbb{Q}$ be an elliptic curve and let $L\geq 2$ be a positive
integer. Assume that there are infinitely many primes $p_{i}$ such that
$\\#{E}_{p_{i}}(\mathbb{F}_{p_{i}})$ is prime. Then as $X\rightarrow\infty$ we
have that

$\displaystyle\pi_{E,L}(X)$ $\displaystyle\asymp\frac{\sqrt{X}}{(\log
X)^{L}}\quad{\rm if}\>E\>{\rm
does\>not\>have\>complex\>multiplication\>(CM)},$ $\displaystyle\pi_{E,2}(X)$
$\displaystyle\sim A_{E}\frac{X}{(\log X)^{2}}\quad{\rm if}\>E\>{\rm
has\>CM},$

where the implied constants in $\asymp$ are both positive and depend only on
$E$ and $L$ and $A_{E}$ is a precise positive constant.

######  Remarks 1.2.

(i) We may interpret the case $L=1$ in Conjecture 1.1 as describing primes $p$
for which $\\#{E}_{p}(\mathbb{F}_{p})=p$. These primes are called anomalous
primes and were previously considered by Mazur [Maz]. In this case, Conjecture
1.1 is a special case of a conjecture of Lang and Trotter [LaTr].

(ii) Silverman and Stange [SiSt] focused primarily on the CM case. They showed
that if $E/\mathbb{Q}$ has CM with $j$-invariant $j_{E}\neq 0$ then there are
no normalized aliquot cycles of length $L\geq 3$ for primes $p\geq 5$. This
implies that $\pi_{E,L}(X)=O(1)$. If $E$ has CM with $j_{E}=0$ then they
showed that $E$ does not have any normalized aliquot triples $(p,q,r)$ with
$p>7$. However, it is unknown if $\pi_{E,L}(X)=O(1)$ when $j_{E}=0$ and $L>3$
and no conjecture is given in this case. Also, no formula is given for $A_{E}$
in Conjecture 1.1.

(iii) We remark that for $1\leq i\leq L-1$, we have that

$p_{i}^{-}:=p_{i}+1-2\sqrt{p_{i}}<p_{i+1}:=\\#E_{p_{i}}(\mathbb{F}_{p_{i}})<p_{i}^{+}:=p_{i}+1+2\sqrt{p_{i}}$
(1.1)

by Hasse’s Theorem (see [Sil, Chapter V, Theorem 1.1]).

Jones [Jon] refined Conjecture 1.1 in the non-CM case. He gave a precise
conjectural constant $C_{E,L}$ in the asymptotic formula for $\pi_{E,L}(X)$.
This formula was obtained by using a probabilistic model which adjusted the
local probabilities at each prime.

######  Conjecture 1.3 (Jones).

Let $E/\mathbb{Q}$ be an elliptic curve without complex multiplication and let
$L\geq 2$ be a positive integer. Then there is a non-negative real constant
$C_{E,L}\geq 0$ such that, as $X\rightarrow\infty$, we have that

$\pi_{E,L}(X)\sim C_{E,L}\int_{2}^{X}\frac{1}{2\sqrt{t}(\log t)^{L}}dt.$

In Conjecture 1.1 we assume that there are infinitely many primes $p$ such
that $\\#E_{p}(\mathbb{F}_{p})$ is prime. Koblitz [Kob] gave the following
conjecture for the number of primes $p\leq X$ such that
$\\#E_{p}(\mathbb{F}_{p})$ is prime, where the explicit constant in the
asymptotic formula was refined by Zywina [Zyw].

######  Conjecture 1.4 (Koblitz).

Let $E/\mathbb{Q}$ be an elliptic curve without complex multiplication. Then
there exists a constant $C_{E}^{\rm twin}$ depending only on $E$ such that as
$X\rightarrow\infty$

$\pi_{E}^{\rm twin}(X):=\\#\\{p\leq X:\\#E_{p}(\mathbb{F}_{p})\>{\rm
is\>prime}\\}\sim C_{E}^{\rm twin}\frac{X}{(\log X)^{2}}.$

######  Remarks 1.5.

(i) Jones [Jon] showed that under the assumption of Conjecture 1.4 there are
examples of elliptic curves such that $C_{E,L}=0$.

(ii) There are also other famous conjectures about the distributions of
invariants associated with the reductions of elliptic curves over finite
fields. These include the Sato-Tate conjecture for the distribution of the
angles associated to the normalized traces $\frac{a_{p}(E)}{2\sqrt{p}}$ (we
refer the reader to the survey paper [MuMu] for an introduction) and the Lang-
Trotter conjecture [LaTr] for the number of primes $p\leq X$ such that
$a_{p}(E)=t$ for a fixed integer $t$.

(iii) The Sato-Tate conjecture was recently proven for elliptic curves over
totally real fields which have multiplicative reduction at some primes by
Harris, Shepherd-Barron and Taylor [HSBT], but the other conjectures are
completely open. For example, for the Lang-Trotter conjecture in the case
$t\neq 0$ we do not even know if there exist infinitely many primes $p$ such
that $a_{p}(E)=t$ for any elliptic curve over $\mathbb{Q}$. The case $t=0$
corresponds to supersingular primes and was considered by Elkies [Elk]. He
showed that every elliptic curve over $\mathbb{Q}$ has infinitely many
supersingular primes.

To gain insight into the above conjectures, it is natural to consider their
averages over some family of elliptic curves. Let $a,b$ be integers and let
$E_{a,b}$ be the elliptic curve given by the Weierstrass equation

$E_{a,b}:y^{2}=x^{3}+ax+b,$

with the discriminant $\Delta(E_{a,b})\neq 0$. For $A,B>0$ we consider the two
parameter family of elliptic curves

${\mathcal{C}}:={\mathcal{C}}(A,B)=\\{E_{a,b}:|a|\leq A,|b|\leq
B,\Delta(E_{a,b})\neq 0\\}.$ (1.2)

In this paper we study the average for $\pi_{E,L}(X)$ over the family
${\mathcal{C}}(A,B)$ in $\eqref{ecfamily}$, that is, we consider the sum
$\displaystyle{\frac{1}{|{\mathcal{C}}|}\sum_{E\in{\mathcal{C}}}\pi_{E,L}(X)}$.
Our main result is the following theorem.

######  Theorem 1.6.

Let $\epsilon>0$, let $E/\mathbb{Q}$ be an elliptic curve and let
${\mathcal{C}}$ be the family of elliptic curves in $\eqref{ecfamily}$ with

$A,B>X^{\epsilon}\quad{\rm and}\quad X^{\frac{3L}{2}}(\log
X)^{6}<AB<e^{X^{\frac{1}{6}-\epsilon}}.$

Then as $X\rightarrow\infty$ we have that

$\frac{1}{|{\mathcal{C}}|}\sum_{E\in{\mathcal{C}}}\pi_{E,L}(X)\ll_{L}\frac{\sqrt{X}}{(\log
X)^{L}},$

where the implied constant depends on $L$ only.

######  Remarks 1.7.

(i) Note that the additional condition $AB<e^{X^{\frac{1}{6}-\epsilon}}$ is
not a limiting constraint since we are mainly interested in averages for small
values of $A$ and $B$.
(ii) In $\eqref{alitriverror}$ we show that a trivial upper bound for the
average is

$\frac{1}{|{\mathcal{C}}|}\sum_{E\in{\mathcal{C}}}\pi_{E,L}(X)\ll_{L}\sqrt{X}(\log\log
X)^{L}$

with

$A,B>X^{L}(\log X)^{L}(\log\log X)^{L}\quad{\rm and}\quad AB>X^{2L}(\log
X)^{L}(\log\log X)^{L}.$

In Proposition 3.2 we consider a sum of a product of class numbers over primes
in a short interval. To obtain the conjectured upper bound for the average
number of aliquot cycles over the family ${\mathcal{C}}$ we require the use of
the fundamental lemma of sieve methods (see Lemma 2.6) as well as a result of
Granville and Soundararajan [GrSo] (see Proposition 2.1) to bound the error
terms. This approach is also used in the work of Chandee, David,
Koukoulopoulos and Smith [CDKS, Proposition 4.1]. However in their work, they
are led to consider a sum of class numbers, whereas in our case we need to
consider a sum of a product of class numbers.

To improve the bounds on $A$ and $B$, in Lemma 3.4, we consider the sum of
aliquot cycles over representatives of isomorphism classes of elliptic curves.
As in Banks and Shparlinski [BaSh] and Balog, Cojocaru, and David [BCD], we
require the use of the large sieve inequality and a result of Friedlander and
Iwaniec [FrIw2] (see Theorem 2.5). However, our calculations become much more
technical since we must consider a product of $L$ characters.

######  Remarks 1.8.

(i) Let $\epsilon>0$. The Lang-Trotter conjecture was shown to hold on average
in the case $t=0$ for the family ${\mathcal{C}}(A,B)$ with
$A,B>X^{\frac{1}{2}+\epsilon}$ and $AB>X^{\frac{3}{2}+\epsilon}$ by Fouvry and
Murty [FoMu, Thoerem 6]. David and Pappalardi [DaPa] then showed that the
Lang-Trotter conjecture holds on average for any integer $t\neq 0$. The bounds
on the size of $A$ and $B$ are an important feature of average results and
several techniques for improving them have been developed. Baier [Bai] showed
that the Lang-Trotter conjecture holds on average for any integer $t$ with
$A,B>X^{\epsilon}$ and $AB>X^{3/2+\epsilon}$. Banks and Shparlinski [BaSh]
used multiplicative character sums to show that the Sato-Tate Conjecture holds
on average for the family ${\mathcal{C}}(A,B)$ with $A,B>X^{\epsilon}$ and
$AB>X^{1+\epsilon}$. Finally, the Koblitz conjecture was shown to hold on
average for the family ${\mathcal{C}}(A,B)$ with $A,B>X^{\epsilon}$ and
$AB>X^{1+\epsilon}$ by Balog, Cojocaru, and David [BCD].

Average results can give strong evidence for the distribution conjectures
discussed above, because they also produce average conjectural constants in
their respective asymptotic formulas. To derive a formula for the constant
$C_{E,L}$ given in Conjecture 1.3 we need to study ${\rm Prob}(\ell\nmid
p+1-a_{p}(E))$ for primes $\ell$ and $p$.

For a non-zero integer $n$, we denote the $n$-torsion subgroup of $E$ by
$E[n]$. Let $\mathbb{Q}(E[n])$ be the field generated by adjoining to
$\mathbb{Q}$ the $x$ and $y$-coordinates of the $n$-torsion points of $E$. We
have that $E[n]\cong\mathbb{Z}/n\mathbb{Z}\times\mathbb{Z}/n\mathbb{Z}$ for
$n\geq 2$. Since each element of the Galois group ${\rm
Gal}(\bar{\mathbb{Q}}/\mathbb{Q})$ acts on $E[n]$ we have that ${\rm
Gal}(\mathbb{Q}(E[n])/\mathbb{Q})\subseteq{\rm
GL}_{2}(\mathbb{Z}/n\mathbb{Z})$ (see [Sil, Chapter III.7]).

If $[{\rm GL}_{2}(\mathbb{Z}/n\mathbb{Z}):{\rm
Gal}(\mathbb{Q}(E[n])/\mathbb{Q})]\leq 2$ for each $n\geq 1$ (see [Ser, pp.
309-311] and [LaTr, p. 51]) then $E$ is called a Serre curve. Jones [Jon] has
shown that for any Serre curve $E$, we have that $C_{E,L}>0$ and
$C_{E,L}=C_{L}\cdot f_{L}(\Delta_{sf}(E))$, where $\Delta_{sf}(E)$ denotes the
square-free part of the discriminant of any Weierstrass model of $E$ and
$f_{L}$ is a positive function which approaches 1 as
$\Delta_{sf}(E)\rightarrow\infty$. In particular, for $L=2$, Jones [Jon] gave
the formula

$C_{2}=\frac{8}{3\pi^{2}}\prod_{\ell\>{\rm
prime}}\frac{\ell^{2}(\ell^{4}-2\ell^{3}-2\ell^{2}+3\ell+3)}{((\ell^{2}-1)(\ell-1))^{2}}.$

In a future work [Pa] we plan to verify the conjectural constant $C_{2}$ by
obtaining an asymptotic result for the average of $\pi_{E,2}(X)$.

###  1.1. Acknowledgment

This work constitutes a large portion of my PhD thesis. I thank my advisor,
Chantal David for all her great advice and support while working on this
problem. I would also like to thank Dimitris Koukoulopoulos and Amir Akbary
for their helpful discussions related to this paper.

##  2\. Preliminaries

For a basic introduction to the theory of elliptic curves we refer the reader
to [Sil]. Here, and in the rest of the paper, we let $\chi_{d}(n)$ denote the
quadratic Dirichlet character defined by the Kronecker symbol namely,

$\chi_{d}(n):=\left(\frac{d}{n}\right).$

We let

$L(s,\chi_{d}):=\sum_{n=1}^{\infty}\frac{\chi_{d}(n)}{n^{s}}=\prod_{\ell\>{\rm
prime}}\left(1-\frac{\chi_{d}(\ell)}{\ell^{s}}\right)^{-1}\quad{\rm
for\>Re}(s)>1,$

be the Dirichlet $L$-function associated to $\chi_{d}$. For $y>1$ we define
the truncated quadratic Dirichlet $L$-function as

$L(1,\chi_{d};y):=\prod_{\ell\leq
y}\left(1-\frac{\chi_{d}(\ell)}{\ell}\right)^{-1}.$

The following proposition is a consequence of a result of Granville and
Soundararajan [GrSo] essentially due to Elliot [Ell]. It allows us to bound
the error terms in our calculations in Proposition 3.2.

######  Proposition 2.1 (Granville-Soundararajan).

Let $\alpha\geq 1$ and $Q\geq 3$. There is a set
${\mathcal{E}}_{\alpha}(Q)\subset[1,Q]$ of at most $Q^{\frac{2}{\alpha}}$
integers such that if $\chi$ is a quadratic Dirichlet character of conductor
$q\leq Q$ not in ${\mathcal{E}}_{\alpha}(Q)$, then

$L(1,\chi)=L(1,\chi;(\log
Q)^{8\alpha^{2}})\left(1+O_{\alpha}\left(\frac{1}{(\log
Q)^{\alpha}}\right)\right).$

###### Proof.

The result is stated in terms of primitive characters in [GrSo, Proposition
2.2]. The proof of the proposition in its present form is given in [CDKS,
Lemma 2.2]. ∎

We now state the analytic class number formula for quadratic Dirichlet
$L$-functions, (see Davenport [Dav, Chapter 6]).

######  Theorem 2.2.

Let $D=df^{2}$ be a negative number such that $d$ is a negative fundamental
discriminant and let $\chi_{D}$ be the Kronecker symbol. Then

$\frac{h(d)}{w(d)}=\frac{\sqrt{-D}}{2\pi}L(1,\chi_{D})$

where $h(d)$ denotes the usual class number of the imaginary quadratic order
of discriminant $d$ and $w(d)$ is the number of roots of unity in
$\mathbb{Q}(\sqrt{d})$.

We recall the following formulation of the definition of the Hurwitz-Kronecker
class number, (see Lenstra [Len]). Let $D$ be a negative (not necessarily
fundamental) discriminant then the Hurwitz-Kronecker class number of
discriminant $D$ is defined by

$H(D)=\sum_{\begin{subarray}{c}f^{2}|D\\\ \frac{D}{f^{2}}\equiv
0,1\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,4)\end{subarray}}\frac{h\left(\frac{D}{f^{2}}\right)}{w\left(\frac{D}{f^{2}}\right)}.$

This leads to the following useful result of Deuring [Deu].

######  Theorem 2.3 (Deuring).

Let $p>3$ be a prime and let $t$ be an integer such that $t^{2}-4p<0$. Then

$\sum_{\begin{subarray}{c}\bar{E}/\mathbb{F}_{p}\\\
a_{p}(\bar{E})=t\end{subarray}}\frac{1}{\\#{\rm Aut}(\bar{E})}=H(t^{2}-4p),$

where $\bar{E}$ denotes a representative of an isomorphism class of
$E/\mathbb{F}_{p}$.

As in the proof of Balog, Cojocaru, and David [BCD, Lemma 6] we require the
following two theorems in the proof of Lemma 3.4. We first state the large
sieve inequality for Dirichlet characters, for a proof, we refer the reader to
Davenport [Dav, Chapter 27].

######  Theorem 2.4.

Let $M,N,Q$ be positive integers and let $\left\\{a_{n}\right\\}_{n}$ be a
sequence of complex numbers. For a fixed $q\leq Q$, we let $\chi$ be a
Dirichlet character modulo $q$. Then

$\sum_{q\leq Q}\frac{q}{\phi(q)}\sum_{\begin{subarray}{c}\chi\allowbreak\mkern
7.0mu({\operator@font mod}\,\,q)\\\ \chi\>{\rm
primitive}\end{subarray}}\left|\sum_{M<n\leq
M+N}a_{n}\chi(n)\right|^{2}\leq(N+3Q^{2})\sum_{M<n\leq M+N}|a_{n}|^{2}.$

The second theorem is a result of Friedlander and Iwaniec [FrIw2] that bounds
the fourth power moment of Dirichlet characters.

######  Theorem 2.5 (Friedlander-Iwaniec).

Let $q$ and $N$ be positive integers. Let $\chi$ denote a Dirichlet character
modulo $q$, with $\chi_{0}$ denoting the principal character. Then

$\sum_{\chi\neq\chi_{0}}\left|\sum_{n\leq N}\chi(n)\right|^{4}\ll
N^{2}q\log^{6}q.$

Finally, we end this section with a result known as the fundamental lemma of
sieve methods. It is stated in various forms in the literature (see Halberstam
and Richert [HaRi, p. 82] and Iwaniec and Kowalski [IwKo, Lemma 6.3]). The
version we will use is a direct consequence of [FrIw1, Lemma 5]. Here and
throughout the rest of the paper we let $P^{+}(n)$ denote the largest prime
dividing $n$ and let $P^{-}(n)$ denote the smallest prime dividing $n$. We
denote by $(f*g)(n)$ the convolution

$(f*g)(n):=\sum_{d\mid n}f(d)g\left(\frac{n}{d}\right).$

######  Lemma 2.6.

Let $y\geq 2,D=y^{u}$ with $u\geq 2.$ There exists two arithmetic functions
$\lambda^{\pm}\>:\mathbb{N}\rightarrow[-1,1],$ supported in the set
$\\{d\in\mathbb{N}:P^{+}(d)\leq y,d\leq D\\}$, for which

$\begin{cases}(\lambda^{-}*1)(n)=(\lambda^{+}*1)(n)=1&\>{\rm
if}\>P^{-}(n)>y,\\\ (\lambda^{-}*1)(n)\leq 0\leq(\lambda^{+}*1)(n)&\>{\rm
otherwise}.\end{cases}$

Moreover, if $g:\mathbb{N}\rightarrow\mathbb{R}$ is a multiplicative function
with $0\leq g(p)\leq\min\\{2,p-1\\}$ for all primes $p\leq y$ then

$\sum_{d}\frac{\lambda^{\pm}(d)g(d)}{d}=\prod_{p\leq
y}\left(1-\frac{g(p)}{p}\right)(1+O(e^{-u})).$

##  3\. Reduction to an average of class numbers

In this section we prove the main result, Theorem 1.6. We begin this section
by fixing notational conventions that we use for the remainder of the paper.

Let $P:=(p_{1},\ldots,p_{L})$ be a vector of $L$ distinct primes and denote
the smallest prime in the vector as $p:=p_{L+1}:=p_{1}$. For a fixed elliptic
curve $E_{a,b}$, we define the following indicator function which determines
if $P$ is a normalized aliquot cycle of length $L$,

$w(P,E_{a,b}):=\begin{cases}1&{\rm
if}\>\\#E_{p_{i},a,b}(\mathbb{F}_{p_{i}})=p_{i+1}\>{\rm for}\>1\leq i\leq
L,\\\ 0&{\rm otherwise}.\end{cases}$

Let $S:=(s_{1},\ldots,s_{L})$ and $T:=(t_{1},\ldots,t_{L})$ be vectors such
that $s_{i},t_{i}\in\mathbb{F}_{p_{i}}$ for $1\leq i\leq L$. This leads to the
similar function,

$w(P,S,T):=\begin{cases}1&{\rm
if}\>\\#E_{p_{i},s_{i},t_{i}}(\mathbb{F}_{p_{i}})=p_{i+1}\>{\rm for}\>1\leq
i\leq L,\\\ 0&{\rm otherwise}.\end{cases}$ (3.1)

We also define the following products

$\mathbb{F}(P):=\mathbb{F}_{p_{1}}\times\cdots\times\mathbb{F}_{p_{L}}\quad{\rm
and}\quad\mathbb{F}(P)^{*}:=\mathbb{F}_{p_{1}}^{*}\times\cdots\times\mathbb{F}_{p_{L}}^{*}.$

Thus,

$\sum_{S,T\in\mathbb{F}(P)}1=\sum_{\begin{subarray}{c}1\leq s_{1}\leq p_{1}\\\
1\leq t_{1}\leq p_{1}\end{subarray}}\cdots\sum_{\begin{subarray}{c}1\leq
s_{L}\leq p_{L}\\\ 1\leq t_{L}\leq p_{L}\end{subarray}}1\quad{\rm
and}\quad\sum_{S,T\in\mathbb{F}(P)^{*}}1=\sum_{\begin{subarray}{c}1\leq
s_{1}<p_{1}\\\ 1\leq
t_{1}<p_{1}\end{subarray}}\cdots\sum_{\begin{subarray}{c}1\leq s_{L}<p_{L}\\\
1\leq t_{L}<p_{L}\end{subarray}}1.$

For positive integers $m$ and $n$ we define the symmetric function that arises
from the application of Theorem 2.3

$D(m,n):=(m+1-n)^{2}-4m=(n+1-m)^{2}-4n=D(n,m).$

Finally, we recall the definitions of $\eqref{pplusminus}$ and
$\eqref{ecfamily}$. We denote the sum over $P$ as

$\sum_{\begin{subarray}{c}p\leq X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq
i\leq L-1\end{subarray}}1:=\sum_{p_{1}\leq
X}\sum_{p_{1}^{-}<p_{2}<p_{1}^{+}}\cdots\sum_{p_{L-1}^{-}<p_{L}<p_{L-1}^{+}}1,$

and we have that $|{\mathcal{C}}|=4AB+O(A+B+1)$.

We begin by considering the trivial upper bound for the average number of
aliquot cycles. We have that

$\displaystyle\frac{1}{|{\mathcal{C}}|}\sum_{E\in{\mathcal{C}}}\pi_{E,L}(X)$
$\displaystyle=$
$\displaystyle\frac{1}{|{\mathcal{C}}|}\sum_{E_{a,b}\in{\mathcal{C}}}\sum_{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}w(P,E_{a,b})=\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{E_{a,b}\in{\mathcal{C}}}w(P,E_{a,b})$ (3.2)
$\displaystyle=$
$\displaystyle\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{S,T\in\mathbb{F}(P)}w(P,S,T)\sum_{\begin{subarray}{c}|a|\leq
A,|b|\leq B\\\ a\equiv s_{i}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{i})\\\ b\equiv t_{i}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{i})\\\ 1\leq i\leq L\end{subarray}}1$ $\displaystyle=$
$\displaystyle\frac{4AB}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{S,T\in\mathbb{F}(P)}\frac{w(P,S,T)}{p_{1}^{2}\cdots
p_{L}^{2}}+O\Bigg{(}\frac{(B+A)}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{S,T\in\mathbb{F}(P)}\frac{w(P,S,T)}{p_{1}\cdots
p_{L}}$ $\displaystyle+$
$\displaystyle\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{S,T\in\mathbb{F}(P)}w(P,S,T)\Bigg{)},$ (3.3)

where

$\sum_{S,T\in\mathbb{F}(P)}w(P,S,T)=\sum_{\begin{subarray}{c}1\leq
s_{1},t_{1}\leq p_{1}\\\
\\#E_{p_{1},s_{1},t_{1}}(\mathbb{F}_{p_{1}})=p_{2}\end{subarray}}\cdots\sum_{\begin{subarray}{c}1\leq
s_{L},t_{L}\leq p_{L}\\\
\\#E_{p_{L},s_{L},t_{L}}(\mathbb{F}_{p_{L}})=p_{1}\end{subarray}}1.$ (3.4)

For $1\leq i\leq L$ the sums in $\eqref{wexpresstriv}$ over $s_{i}$ and
$t_{i}$ can be changed to a sum over isomorphism classes which we denote by
$\bar{E}_{p_{i},s_{i},t_{i}}$. Then we have that

$\displaystyle\sum_{\begin{subarray}{c}1\leq s_{i},t_{i}\leq p_{i}\\\
\\#E_{p_{i},s_{i},t_{i}}(\mathbb{F}_{p_{i}})={p_{i+1}}\end{subarray}}1$
$\displaystyle=\sum_{\begin{subarray}{c}\bar{E}_{p_{i},s_{i},t_{i}}/\mathbb{F}_{p_{i}}\\\
p_{i}+1-a_{p_{i}}(\bar{E}_{p_{i},s_{i},t_{i}})=p_{i+1}\end{subarray}}\frac{p_{i}-1}{\\#\rm
Aut(\bar{E}_{p_{i},s_{i},t_{i}}(\mathbb{F}_{p_{i}}))}$
$\displaystyle=(p_{i}-1)H((p_{i}+1-p_{i+1})^{2}-4p_{i})=(p_{i}-1)H(D(p_{i},p_{i+1})),$
(3.5)

by Theorem 2.3. From the convexity bound for a Dirichlet character $\chi$ of
modulus $d$, we have that $L(1,\chi_{d})\ll\log|d|$. Therefore, by the
analytic class number formula for $1\leq i\leq L$, we deduce that

$\displaystyle H(D(p_{i},p_{i+1}))$
$\displaystyle=\sum_{\begin{subarray}{c}f^{2}|D(p_{i},p_{i+1})\\\
\frac{D(p_{i},p_{i+1})}{f^{2}}\equiv 0,1\allowbreak\mkern
7.0mu({\operator@font
mod}\,\,4)\end{subarray}}\frac{\sqrt{|D(p_{i},p_{i+1})|}}{2\pi
f}L\left(1,\left(\frac{D(p_{i},p_{i+1})/f^{2}}{\cdot}\right)\right)$
$\displaystyle\ll\sqrt{|D(p_{i},p_{i+1})|}(\log p_{i})\sum_{f\mid
D(p_{i},p_{i+1})}\frac{1}{f}\ll\sqrt{p_{i}}(\log
p_{i})(\log\log|D(p_{i},p_{i+1})|)$ $\displaystyle\ll\sqrt{p}(\log p)(\log\log
p),$ (3.6)

since $p_{i}=p+O(\sqrt{p})$.

Thus, from $\eqref{alitrivtwo}$ and $\eqref{hdellbound}$ we have that the main
term in $\eqref{alitrivone}$ is bounded by

$\displaystyle\frac{AB}{|{\mathcal{C}}|}\sum_{p\leq
X}\frac{1}{p^{L}}\sum_{\begin{subarray}{c}p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq
i\leq L-1\end{subarray}}\prod_{j=1}^{L}H(D(p_{j},p_{j+1}))$
$\displaystyle\ll_{L}$
$\displaystyle\left(1+O\left(\frac{1}{A}+\frac{1}{B}+\frac{1}{AB}\right)\right)\sum_{p\leq
X}\frac{1}{p^{L}}\frac{p^{\frac{L-1}{2}}}{(\log p)^{L-1}}p^{\frac{L}{2}}(\log
p)^{L}(\log\log p)^{L}$ $\displaystyle\ll_{L}$ $\displaystyle\sum_{p\leq
X}\frac{\log p(\log\log p)^{L}}{\sqrt{p}}\ll_{L}\sqrt{X}(\log\log X)^{L}.$
(3.7)

Similarly, the error term in $\eqref{alitrivone}$ is bounded by

$\displaystyle\left(\frac{1}{A}+\frac{1}{B}\right)X^{L+\frac{1}{2}}(\log\log
X)^{L}+\frac{X^{2L+\frac{1}{2}}(\log\log X)^{L}}{AB}.$ (3.8)

Hence, from $\eqref{alitriverror}$ to obtain the correct upper bound for the
average we need

$A,B>X^{L}(\log X)^{L}(\log\log X)^{L}\quad{\rm and}\quad AB>X^{2L}(\log
X)^{L}(\log\log X)^{L},$

whereas $\pi_{E,L}(X)$ only considers primes of size at most $X$. Also, we see
that using the bound from $\eqref{hdellbound}$ for $H(D(p_{i},p_{i+1}))$ in
$\eqref{alitrivone}$ does not give the correct order of magnitude for the main
term in $\eqref{alitrivmain}$. Therefore, to obtain the conjectured upper
bound for Theorem 1.6 we develop techniques not present in the estimations
above. This is the approach of the following theorem.

######  Theorem 3.1.

Let $\epsilon>0$, let $E/\mathbb{Q}$ be an elliptic curve and let
${\mathcal{C}}$ be the family of elliptic curves in $\eqref{ecfamily}$ with

$A,B>X^{\epsilon}\quad{\rm and}\quad X^{\frac{3L}{2}}(\log
X)^{6}<AB<e^{X^{\frac{1}{6}-\epsilon}}.$

Then as $X\rightarrow\infty$ we have that

$\frac{1}{|{\mathcal{C}}|}\sum_{E\in{\mathcal{C}}}\pi_{E,L}(X)=\Bigg{(}\sum_{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\prod_{j=1}^{L}\frac{H(D(p_{j},p_{j+1}))}{p_{j}}\Bigg{)}\left(1+O\left(\frac{1}{X^{\epsilon}}\right)\right).$
(3.9)

We have that the sum on the RHS of $\eqref{avgthrmsum}$ is

$\displaystyle\sum_{p\leq
X}\frac{1}{p^{L}}\prod_{i=1}^{L-2}\Bigg{(}\sum_{p_{i}^{-}<p_{i+1}<p_{i}^{+}}H(D(p_{i},p_{i+1}))\Bigg{)}\sum_{p_{L-1}^{-}<p_{L}<p_{L-1}^{+}}H(D(p_{L-1},p_{L}))H(D(p_{L},p))$
$\displaystyle\times$
$\displaystyle\left(1+O_{L}\left(\frac{1}{\sqrt{p}}\right)\right),$

since $p_{i}=p+O(\sqrt{p})$ for $1<i\leq L$. We use the following technical
propositions to bound the inner sums above.

######  Proposition 3.2.

Fix primes $p,r>3$ not necessarily distinct with $r=p+O(\sqrt{p})$ and let $q$
be a prime in the range $p^{-}<q<p^{+}$ with $q\neq p$ or $r$. Then we have
that

$\sum_{p^{-}<q<p^{+}}H(D(p,q))H(D(r,q))\ll\frac{p^{\frac{3}{2}}}{\log p}.$

######  Proposition 3.3.

Let $p$ and $q$ be distinct primes such that $p^{-}<q<p^{+}$. Then we have
that

$\sum_{p^{-}<q<p^{+}}H(D(p,q))\ll\frac{p}{\log p}.$

We delay the proofs of Proposition 3.2 and Proposition 3.3 until the following
section. We now have that Theorem 1.6 is an immediate consequence of Theorem
3.1.

###### Proof.

(Proof of Theorem 1.6) From Proposition 3.2 and Proposition 3.3 we have by
partial summation that the main term in $\eqref{avgthrmsum}$ is

$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\prod_{j=1}^{L}\frac{H(D(p_{j},p_{j+1}))}{p_{j}}=$
$\displaystyle\sum_{p\leq
X}\frac{1}{p^{L}}\prod_{i=1}^{L-2}\Bigg{(}\sum_{p_{i}^{-}<p_{i+1}<p_{i}^{+}}H(D(p_{i},p_{i+1}))\Bigg{)}$
$\displaystyle\times$
$\displaystyle\sum_{p_{L-1}^{-}<p_{L}<p_{L-1}^{+}}H(D(p_{L-1},p_{L}))H(D(p_{L},p))\left(1+O_{L}\left(\frac{1}{\sqrt{p}}\right)\right)$
$\displaystyle\ll_{L}$ $\displaystyle\sum_{p\leq
X}\frac{1}{p^{L}}\frac{p^{L-2}}{(\log p)^{L-2}}\frac{p^{\frac{3}{2}}}{\log
p}=\sum_{p\leq X}\frac{1}{\sqrt{p}(\log p)^{L-1}}\ll_{L}\frac{\sqrt{X}}{(\log
X)^{L}}.$

∎

###### Proof.

(Proof of Theorem 3.1) We begin the proof by recalling $\eqref{alibegin}$,

$\frac{1}{|{\mathcal{C}}|}\sum_{E\in{\mathcal{C}}}\pi_{E,L}(X)=\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{E_{a,b}\in{\mathcal{C}}}w(P,E_{a,b}).$

To obtain an improvement on this sum, instead of summing over elliptic curves,
we will sum over representatives of isomorphism classes. Let $E_{s,t}$ be an
elliptic curve defined over $\mathbb{F}_{p}$. We count the curves
$E_{a,b}\in{\mathcal{C}}$ whose reductions modulo $p$ are isomorphic to
$E_{s,t}$ over $\mathbb{F}_{p}$. Recall that two elliptic curves $E_{s,t}$ and
$E_{s^{\prime},t^{\prime}}$ are isomorphic over $\mathbb{F}_{p}$ if and only
if there exists a $u\in\mathbb{F}_{p}^{*}$ such that $s^{\prime}=su^{4}$ and
$t^{\prime}=tu^{6}$. Thus, we have that the number of elliptic curves over
$\mathbb{F}_{p}$ isomorphic to $E_{s,t}$ is

$\frac{\\#\mathbb{F}_{p}^{*}}{\\#\rm Aut(E_{s,t})}=\frac{p-1}{\\#\rm
Aut(E_{s,t})}.$

More precisely, if we are counting $|a|\leq A,|b|\leq B$ such that if there
exists $u_{i}\in\mathbb{F}_{p_{i}}^{*}$ such that $a\equiv
s_{i}u_{i}^{4}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i})$ and
$b\equiv t_{i}u_{i}^{6}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i})$
then for each fixed elliptic curve $E_{s_{i},t_{i}}$ we will be over counting
by the number of elliptic curves over $\mathbb{F}_{p_{i}}$ isomorphic to
$E_{s_{i},t_{i}}$. By correcting for this over count we have that the sum over
elliptic curves in $\eqref{alibegin}$ becomes

$\sum_{E_{a,b}\in{\mathcal{C}}}w(P,E_{a,b})=\sum_{S,T\in\mathbb{F}(P)}w(P,S,T)\prod_{j=1}^{L}\frac{\\#\rm
Aut(E_{p_{j},s_{j},t_{j}})}{(p_{j}-1)}\sum_{\begin{subarray}{c}|a|\leq
A,|b|\leq B\\\ \exists(u_{1},\ldots,u_{L})\in\mathbb{F}(P)^{*}\\\ a\equiv
s_{i}u_{i}^{4}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i}),b\equiv
t_{i}u_{i}^{6}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i})\\\ 1\leq
i\leq L\end{subarray}}1.$

Hence, $\eqref{alibegin}$ becomes

$\frac{1}{|{\mathcal{C}}|}\sum_{E\in{\mathcal{C}}}\pi_{E,L}(X)=\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{S,T\in\mathbb{F}(P)}w(P,S,T)R(P,S,T)\prod_{j=1}^{L}\frac{\\#\rm
Aut(E_{p_{j},s_{j},t_{j}})}{(p_{j}-1)},$ (3.10)

where $R(P,S,T)$ is the number of integers $|a|\leq A,|b|\leq B$ such that
there exists a vector $(u_{1},\ldots,u_{L})\in\mathbb{F}(P)^{*}$ satisfying

$a\equiv s_{i}u_{i}^{4}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{i}),\quad b\equiv t_{i}u_{i}^{6}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\quad{\rm for}\>1\leq i\leq L.$ (3.11)

For an elliptic curve $E_{s,t}/\mathbb{F}_{p}$, we have that the order of the
automorphism group of $E_{s,t}$ is given by

$\\#\rm Aut(E_{s,t})=\begin{cases}6&{\rm if}\>s=0\>{\rm and}\>p\equiv
1\allowbreak\mkern 7.0mu({\operator@font mod}\,\,3),\\\ 4&{\rm if}\>t=0\>{\rm
and}\>p\equiv 1\allowbreak\mkern 7.0mu({\operator@font mod}\,\,4),\\\ 2&{\rm
otherwise}.\end{cases}$

Thus, we split up the sum in $\eqref{aliquotaut}$ into two cases,
$s_{i}t_{i}\neq 0$ and $s_{i}t_{i}=0$ to write $\eqref{aliquotaut}$ as

$\displaystyle\frac{1}{|{\mathcal{C}}|}\sum_{E\in{\mathcal{C}}}\pi_{E,L}(X)=$
$\displaystyle\frac{2^{L}}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{S,T\in\mathbb{F}(P)^{*}}\frac{w(P,S,T)R(P,S,T)}{(p_{1}-1)\cdots(p_{L}-1)}$
$\displaystyle+$
$\displaystyle\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{\begin{subarray}{c}S,T\in\mathbb{F}(P)\\\
s_{i}t_{i}=0\\\ {\rm for\>some}\>1\leq i\leq
L\end{subarray}}w(P,S,T)R(P,S,T)\prod_{j=1}^{L}\frac{\\#\rm
Aut(E_{p_{j},s_{j},t_{j}})}{(p_{j}-1)}.$ (3.12)

We can express the first sum in $\eqref{alione}$ as

$\displaystyle\frac{4AB}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\prod_{j=1}^{L}\frac{1}{p_{j}(p_{j}-1)}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)$
$\displaystyle+$
$\displaystyle\frac{2^{L}}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\prod_{j=1}^{L}\frac{1}{(p_{j}-1)}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)\left(R(P,S,T)-\frac{4AB}{2^{L}p_{1}\cdots
p_{L}}\right).$ (3.13)

The first term in $\eqref{alitwo}$ contributes to the main term and we use the
following technical lemma, where we delay its proof to Section 5, to bound the
second term in $\eqref{alitwo}$.

######  Lemma 3.4.

Let $L\geq 2$ be an integer, let $E/\mathbb{Q}$ be an elliptic curve and let
$A,B>0$. Then for any positive integer $k$, as $X\rightarrow\infty$ we have
that

$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)\left(R(P,S,T)-\frac{AB}{2^{L-2}p_{1}\cdots
p_{L}}\right)$ $\displaystyle\ll_{k,L}$ $\displaystyle
ABX^{\frac{1}{2}-\frac{L+1}{4k}}(\log X)^{\frac{L}{2k}}(\log\log
X)^{L}\left((\log A)^{\frac{k^{2}-1}{2k}}+(\log
B)^{\frac{k^{2}-1}{2k}}\right)$ $\displaystyle+$
$\displaystyle(A\sqrt{B}+B\sqrt{A})X^{\frac{1}{2}+\frac{3L-1}{4k}}(\log
X)^{\frac{k^{2}+L-1}{2k}}(\log\log X)^{L}+\sqrt{AB}X^{\frac{3L+2}{4}}(\log
X)^{3-L},$ (3.14)

where $w(P,S,T)$ is given in $\eqref{defnofwpst}$ and $R(P,S,T)$ is given in
$\eqref{rpst}$.

Thus, from Lemma 3.4 we have that for any positive integer $k$, the second sum
in $\eqref{alitwo}$ becomes

$\displaystyle\frac{2^{L}}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{(p_{1}-1)\cdots(p_{L}-1)}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)\left(R(P,S,T)-\frac{4AB}{2^{L}p_{1}\cdots
p_{L}}\right)$ $\displaystyle\ll_{L,k}$ $\displaystyle
X^{\frac{1}{2}-\frac{L+1}{4k}}(\log X)^{\frac{L}{2k}}(\log\log
X)^{L}\left((\log A)^{\frac{k^{2}-1}{2k}}+(\log
B)^{\frac{k^{2}-1}{2k}}\right)+\frac{1}{\sqrt{AB}}X^{\frac{3L+2}{4}}(\log
X)^{3-L}$ $\displaystyle+$
$\displaystyle\left(\frac{1}{\sqrt{B}}+\frac{1}{\sqrt{A}}\right)X^{\frac{1}{2}+\frac{3L-1}{4k}}(\log
X)^{\frac{k^{2}+L-1}{2k}}(\log\log X)^{L}.$ (3.15)

We now consider the inner sum in the first sum in $\eqref{alitwo}$,

$\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)=\sum_{\begin{subarray}{c}1\leq
s_{1},t_{1}<p_{1}\\\
\\#E_{p_{1},s_{1},t_{1}}(\mathbb{F}_{p_{1}})=p_{2}\end{subarray}}\cdots\sum_{\begin{subarray}{c}1\leq
s_{L},t_{L}<p_{L}\\\
\\#E_{p_{L},s_{L},t_{L}}(\mathbb{F}_{p_{L}})=p_{1}\end{subarray}}1.$ (3.16)

Similarly to the calculation of $\eqref{alitrivtwo}$ we have by Theorem 2.3
that

$\displaystyle\sum_{\begin{subarray}{c}1\leq s_{i},t_{i}<p_{i}\\\
\\#E_{p_{i},s_{i},t_{i}}(\mathbb{F}_{p_{i}})={p_{i+1}}\end{subarray}}1$
$\displaystyle=\sum_{\begin{subarray}{c}\bar{E}_{p_{i},s_{i},t_{i}}/\mathbb{F}_{p_{i}}\\\
p_{i}+1-a_{p_{i}}(\bar{E}_{p_{i},s_{i},t_{i}})=p_{i+1}\end{subarray}}\frac{p_{i}-1}{\\#\rm
Aut(\bar{E}_{p_{i},s_{i},t_{i}}(\mathbb{F}_{p_{i}}))}+O(p_{i})$
$\displaystyle=(p_{i}-1)H((p_{i}+1-p_{i+1})^{2}-4p_{i})+O(p_{i}).$ (3.17)

Thus, from $\eqref{hdellbound}$ and $\eqref{alithree}$ we have that
$\eqref{wexpress}$ becomes

$\displaystyle\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)=$
$\displaystyle\prod_{i=1}^{L}\left((p_{i}-1)H(D(p_{i},p_{i+1}))+O(p_{i})\right)$
$\displaystyle=$
$\displaystyle\prod_{i=1}^{L}(p_{i}-1)H(D(p_{i},p_{i+1}))+O_{L}\left(p^{\frac{3L-1}{2}}(\log
p)^{L-1}(\log\log p)^{L-1}\right).$ (3.18)

Combining $\eqref{dubsum}$ with the first term in $\eqref{alitwo}$ gives

$\displaystyle\frac{4AB}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\prod_{j=1}^{L}\frac{1}{p_{j}(p_{j}-1)}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)$
$\displaystyle=$
$\displaystyle\frac{4AB}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\Bigg{(}\prod_{j=1}^{L}\frac{H(D(p_{j},p_{j+1}))}{p_{j}}+O_{L}\left(\frac{1}{p^{2L}}\cdot
p^{\frac{3L-1}{2}}(\log p)^{L-1}(\log\log p)^{L-1}\right)\Bigg{)}$
$\displaystyle=$ $\displaystyle\Bigg{(}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\prod_{j=1}^{L}\frac{H(D(p_{j},p_{j+1}))}{p_{j}}+O_{L}\left((\log\log
X)^{L}\right)\Bigg{)}\left(1+O_{L}\left(\frac{1}{A}+\frac{1}{B}+\frac{1}{AB}\right)\right).$
(3.19)

We see that the first term in $\eqref{alifive}$ gives the main term in
$\eqref{avgthrmsum}$ and by Proposition 3.2 and Proposition 3.3 we have that
the error term in $\eqref{alifive}$ is bounded by

$\displaystyle\left(\sum_{p\leq X}\frac{1}{p^{L}}\frac{p^{L-2}}{(\log
p)^{L-2}}\frac{p^{\frac{3}{2}}}{\log
p}\right)\left(\frac{1}{A}+\frac{1}{B}+\frac{1}{AB}\right)+(\log\log X)^{L})$
$\displaystyle\ll_{L}$
$\displaystyle\left(\frac{1}{A}+\frac{1}{B}+\frac{1}{AB}\right)\sum_{p\leq
X}\frac{1}{\sqrt{p}(\log
p)^{L-1}}\ll_{L}\left(\frac{1}{A}+\frac{1}{B}+\frac{1}{AB}\right)\frac{\sqrt{X}}{\log
X},$

which is smaller than the second and third terms in the error terms in
$\eqref{aliquotlembound}$.

Thus, it remains to consider the second term in $\eqref{alione}$. Similarly to
the treatment of the average of the Lang-Trotter Conjecture by Baier [Bai,
Theorem 2.1] we have that

$\displaystyle\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{\begin{subarray}{c}S,T\in\mathbb{F}(P)\\\
s_{i}t_{i}=0\\\ {\rm for\>some}\>1\leq i\leq
L\end{subarray}}w(P,S,T)\prod_{j=1}^{L}\frac{\\#\rm
Aut(E_{p_{j},s_{j},t_{j}})}{(p_{j}-1)}\sum_{\begin{subarray}{c}|a|\leq
A,|b|\leq B\\\ \exists(u_{1},\ldots,u_{L})\in\mathbb{F}(P)^{*}\\\ a\equiv
s_{i}u_{i}^{4}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i})\\\
b\equiv t_{i}u_{i}^{6}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{i})\\\ 1\leq i\leq L\end{subarray}}1$ $\displaystyle\ll_{L}$
$\displaystyle\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{\begin{subarray}{c}|a|\leq A,|b|\leq B\\\ ab\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{1})\>{\rm or}\\\ ab\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>2\leq
i\leq L\end{subarray}}w(P,E_{a,b}).$ (3.20)

If $ab\equiv 0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{j})$ then
fixing $p_{j}$ completely determines the other $p_{i}$ for $1\leq i\neq j\leq
L$ from $w(P,E_{a,b})$. Hence, without loss of generality we can assume that
$ab\equiv 0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{1})$ and we have
that $\eqref{baierone}$ is bounded by

$\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}|a|\leq A\\\ |b|\leq
B\end{subarray}}\sum_{\begin{subarray}{c}p\leq X\\\ p\mid
ab\end{subarray}}w(P,E_{a,b})\ll_{L}\frac{1}{|{\mathcal{C}}|}\sum_{\begin{subarray}{c}|a|\leq
A,|b|\leq B\end{subarray}}\tau(ab)\ll_{L}\frac{1}{|{\mathcal{C}}|}\sum_{n\leq
AB}\tau^{2}(n)\ll_{L}(\log AB)^{3}.$ (3.21)

From $\eqref{aliquotlembound},\eqref{alifive}$ and $\eqref{baierbound}$ we
have that

$\displaystyle\frac{1}{|{\mathcal{C}}|}\sum_{E\in{\mathcal{C}}}$
$\displaystyle\pi_{E,L}(X)=\sum_{p\leq
x}\frac{1}{p^{L}}\sum_{\begin{subarray}{c}p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq
i\leq
L-1\end{subarray}}\prod_{j=1}^{L}H(D(p_{j},p_{j+1}))+O_{L,k}\Bigg{(}(\log
AB)^{3}$ $\displaystyle+$ $\displaystyle X^{\frac{1}{2}-\frac{L+1}{4k}}(\log
X)^{\frac{L}{2k}}(\log\log X)^{L}\left((\log A)^{\frac{k^{2}-1}{2k}}+(\log
B)^{\frac{k^{2}-1}{2k}}\right)+\frac{1}{\sqrt{AB}}X^{\frac{3L+2}{4}}(\log
X)^{3-L}$ $\displaystyle+$
$\displaystyle\left(\frac{1}{\sqrt{B}}+\frac{1}{\sqrt{A}}\right)X^{\frac{1}{2}+\frac{3L-1}{4k}}(\log
X)^{\frac{k^{2}+L-1}{2k}}(\log\log X)^{L}\Bigg{)}.$ (3.22)

Now the first term in the error term of $\eqref{bigaliquott}$ is smaller than
the main term if

$AB<e^{\frac{X^{1/6}}{(\log X)^{L/3}}}.$

The second term in the error term of $\eqref{bigaliquott}$ is smaller than the
main term for any $k\geq 1$. The third term in the error term of
$\eqref{bigaliquott}$ is smaller than the main term if

$AB>X^{\frac{3L}{2}}(\log X)^{6}.$

The fourth term in the error term of $\eqref{bigaliquott}$ is smaller than the
main term if

$A,B>X^{\frac{3L-1}{2k}}(\log X)^{\frac{k^{2}+L-1}{k}+2L}(\log\log X)^{2L}.$

For every $\epsilon>0$ we can find a positive integer $k$ such that

$\epsilon>\frac{3L-1}{2k},$

and therefore the fourth term in the error term of $\eqref{bigaliquott}$ is
smaller than the main term if $A,B>X^{\epsilon}$, which gives the result. ∎

##  4\. Upper bounds on sums of class numbers

###### Proof.

(Proof of Proposition 3.2) We begin by using the analytic class number formula
to relate the class number $H(D)$ to a quadratic Dirichlet $L$-function
evaluated at one. We have that

$\displaystyle\sum_{p^{-}<q<p^{+}}H(D(p,q))H(D(r,q))=$
$\displaystyle\sum_{p^{-}<q<p^{+}}\sum_{\begin{subarray}{c}f_{1}^{2}|D(p,q)\\\
(f_{1},2)=1\end{subarray}}\frac{\sqrt{|D(p,q)|}}{2\pi
f_{1}}L\left(1,\left(\frac{D(p,q)/f_{1}^{2}}{\cdot}\right)\right)$
$\displaystyle\times$
$\displaystyle\sum_{\begin{subarray}{c}f_{2}^{2}|D(r,q)\\\
(f_{2},2)=1\end{subarray}}\frac{\sqrt{|D(r,q)|}}{2\pi
f_{2}}L\left(1,\left(\frac{D(r,q)/f_{2}^{2}}{\cdot}\right)\right),$

since $\frac{D(p,q)}{f^{2}}\not\equiv 0\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,4)$ for $p,q>3$ and $\frac{D(p,q)}{f^{2}}\equiv 1\allowbreak\mkern
7.0mu({\operator@font mod}\,\,4)$ if and only if $f$ is odd. We also have that
$q,r=p+O(\sqrt{p})$ and hence, $D(p,q),D(r,q)\ll p$. With the goal of
obtaining an upper bound for the LHS of the above identity we define the sum

$S_{1}:=\sum_{p^{-}<q<p^{+}}\sum_{\begin{subarray}{c}f_{1}^{2}|D(p,q)\\\
f_{2}^{2}|D(r,q)\\\
(f_{1}f_{2},2)=1\end{subarray}}\frac{L\left(1,\left(\frac{D(p,q)/f_{1}^{2}}{\cdot}\right)\right)L\left(1,\left(\frac{D(r,q)/f_{2}^{2}}{\cdot}\right)\right)}{f_{1}f_{2}}.$
(4.1)

We have that

$\displaystyle L\left(1,\left(\frac{D(p,q)/f_{1}^{2}}{\cdot}\right)\right)$
$\displaystyle=\prod_{\ell}\left(1-\left(\frac{D(p,q)/f_{1}^{2}}{\ell}\right)\frac{1}{\ell}\right)^{-1}\leq\frac{2f_{1}}{\varphi(f_{1})}\prod_{\ell\nmid
2f_{1}}\left(1-\frac{\left(\frac{(2f_{1})^{2}D(p,q)}{\ell}\right)}{\ell}\right)^{-1}$
$\displaystyle\ll\frac{f_{1}}{\varphi(f_{1})}L\left(1,\left(\frac{(2f_{1})^{2}D(p,q)}{\cdot}\right)\right),$
(4.2)

and similarly,

$L\left(1,\left(\frac{D(r,q)/f_{2}^{2}}{\cdot}\right)\right)\ll\frac{f_{2}}{\varphi(f_{2})}L\left(1,\left(\frac{(2f_{2})^{2}D(r,q)}{\cdot}\right)\right).$

To ease notation for the remainder of this section we denote

$\chi_{1}:=\left(\frac{(2f_{1})^{2}D(p,q)}{\cdot}\right)\quad{\rm
and}\quad\chi_{2}:=\left(\frac{(2f_{2})^{2}D(r,q)}{\cdot}\right).$

Now we have that

$S_{1}\ll\sum_{p^{-}<q<p^{+}}\sum_{\begin{subarray}{c}f_{1}^{2}|D(p,q)\\\
f_{2}^{2}|D(r,q)\\\
(f_{1}f_{2},2)=1\end{subarray}}\frac{L\left(1,\chi_{1}\right)L\left(1,\chi_{2}\right)}{\varphi(f_{1})\varphi(f_{2})}\ll\sum_{p^{-}<q<p^{+}}\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
f_{2}|D(r,q)\\\
(f_{1}f_{2},2)=1\end{subarray}}\frac{L\left(1,\chi_{1}\right)L\left(1,\chi_{2}\right)}{\varphi(f_{1})\varphi(f_{2})},$
(4.3)

since the sum on the RHS in $\eqref{mqbound}$ is larger than the sum in
$\eqref{mqprop}$. Then

$\sum_{p^{-}<q<p^{+}}H(D(p,q))H(D(r,q))\ll pS_{1}.$

The remainder of the proof is reduced to showing the bound

$S_{2}:=\sum_{p^{-}<q<p^{+}}\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
f_{2}|D(r,q)\\\
(f_{1}f_{2},2)=1\end{subarray}}\frac{L\left(1,\chi_{1}\right)L\left(1,\chi_{2}\right)}{\varphi(f_{1})\varphi(f_{2})}\ll\frac{\sqrt{p}}{\log
p}.$ (4.4)

Let $S_{2}^{\prime}$ denote the double sum on the LHS of $\eqref{splus}$ with
$L\left(1,\chi_{i};z^{8\alpha^{2}}\right)$ in place of
$L\left(1,\chi_{i}\right)$ for $i=1,2$, where $z:=\log(4p)$ and $\alpha$ is a
parameter $\geq 10$. We estimate the error term $S_{2}-S_{2}^{\prime}$ by
applying Proposition 2.1 once for $L\left(1,\chi_{1}\right)$ with $Q=4p$ and
once for $L\left(1,\chi_{2}\right)$ with $Q=4r$. We have that
$0\leq-D(p,q)\leq 4p$ and $0\leq-D(r,q)\leq 4r$ for $q\in(p^{-},p^{+})$.
Moreover, $\mathbb{Q}(\sqrt{(2f_{1})^{2}D(p,q)})=\mathbb{Q}(\sqrt{D(p,q)}).$
If the conductor of $\chi_{1}$, which is the discriminant of
$\mathbb{Q}(\sqrt{D(p,q)}),$ does not belong to the set
${\mathcal{E}}_{\alpha}(4p)$, or if the conductor of $\chi_{2}$, which is the
discriminant of $\mathbb{Q}(\sqrt{D(r,q)}),$ does not belong to
${\mathcal{E}}_{\alpha}(4r)$, we can bound $L\left(1,\chi_{i}\right)$ by $\log
z$ from Mertens’ theorem. For the exceptional sets
${\mathcal{E}}_{\alpha}(4p)$ and ${\mathcal{E}}_{\alpha}(4r)$ we use the
convexity bound $L\left(1,\chi_{i}\right)\ll z$ for $i=1,2,$ respectively.
This yields the estimate

$\displaystyle S_{2}-S_{2}^{\prime}$ $\displaystyle\ll_{\alpha}$
$\displaystyle\frac{(\log
z)^{2}}{z^{\alpha}}\sum_{\begin{subarray}{c}p^{-}<q<p^{+}\\\ {\rm
disc}(\mathbb{Q}(\sqrt{D(p,q)}))\not\in{\mathcal{E}}_{\alpha}(4p)\\\ {\rm
disc}(\mathbb{Q}(\sqrt{D(r,q)}))\not\in{\mathcal{E}}_{\alpha}(4r)\end{subarray}}\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
f_{2}|D(r,q)\\\
(f_{1}f_{2},2)=1\end{subarray}}\frac{1}{\varphi(f_{1})\varphi(f_{2})}$
$\displaystyle+$ $\displaystyle z\log
z\Bigg{(}\sum_{\begin{subarray}{c}p^{-}<q<p^{+}\\\ {\rm
disc}(\mathbb{Q}(\sqrt{D(p,q)}))\in{\mathcal{E}}_{\alpha}(4p)\\\ {\rm
disc}(\mathbb{Q}(\sqrt{D(r,q)}))\not\in{\mathcal{E}}_{\alpha}(4r)\end{subarray}}\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
f_{2}|D(r,q)\\\
(f_{1}f_{2},2)=1\end{subarray}}\frac{1}{\varphi(f_{1})\varphi(f_{2})}$
$\displaystyle+$ $\displaystyle\sum_{\begin{subarray}{c}p^{-}<q<p^{+}\\\ {\rm
disc}(\mathbb{Q}(\sqrt{D(p,q)}))\not\in{\mathcal{E}}_{\alpha}(4p)\\\ {\rm
disc}(\mathbb{Q}(\sqrt{D(r,q)}))\in{\mathcal{E}}_{\alpha}(4r)\end{subarray}}\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
f_{2}|D(r,q)\\\
(f_{1}f_{2},2)=1\end{subarray}}\frac{1}{\varphi(f_{1})\varphi(f_{2})}\Bigg{)}+z^{2}\sum_{\begin{subarray}{c}p^{-}<q<p^{+}\\\
{\rm disc}(\mathbb{Q}(\sqrt{D(p,q)}))\in{\mathcal{E}}_{\alpha}(4p)\\\ {\rm
disc}(\mathbb{Q}(\sqrt{D(r,q)}))\in{\mathcal{E}}_{\alpha}(4r)\end{subarray}}\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
f_{2}|D(r,q)\\\
(f_{1}f_{2},2)=1\end{subarray}}\frac{1}{\varphi(f_{1})\varphi(f_{2})}.$ (4.5)

For $q\in(p^{-},p^{+})$ such that $\Delta:={\rm
disc}(\mathbb{Q}(\sqrt{D(p,q)}))\in{\mathcal{E}}_{\alpha}(4p)$ we have that
$D(p,q)=\Delta m^{2}$ for some $m\in\mathbb{N}$. Equivalently
$(p+1-q)^{2}-\Delta m^{2}=4p,$ where $\Delta\equiv D(p,q)\equiv
1\allowbreak\mkern 7.0mu({\operator@font mod}\,\,4)$. Let $n=p+1-q$, then for
a fixed $\Delta\in{\mathcal{E}}_{\alpha}(4p)$ we need to determine the
quantity

$\displaystyle r(4p,2):=$
$\displaystyle\\#\\{(m,n)\in\mathbb{Z}^{2}:n^{2}-\Delta m^{2}=4p\\},$
$\displaystyle=$
$\displaystyle\\#\left\\{\frac{n+m\sqrt{\Delta}}{2}\in{\mathcal{O}}_{K}:N\left(\frac{n+m\sqrt{\Delta}}{2}\right)=p\right\\},$

where
$K=\mathbb{Q}(\sqrt{\Delta})=\mathbb{Q}(\sqrt{D(p,q)}),{\mathcal{O}}_{K}$ is
its ring of integers and $N(\cdot)$ is the norm of an element in $K$.

Note that

$\\#\\{I\subseteq{\mathcal{O}}_{K}:N(I)=d\\}=\left(1*\left(\frac{\Delta}{\cdot}\right)\right)(d),$

where $N(I)$ denotes the norm of an ideal $I\subseteq{\mathcal{O}}_{K}$. Thus,

$\frac{r(4p,2)}{6}\leq\\#\\{I\subseteq{\mathcal{O}}_{K}:N(I)=p\\}=\left(1*\left(\frac{\Delta}{\cdot}\right)\right)(p)$

by the above equality. Hence, we conclude that

$r(4p,2)\leq 6\sum_{k\mid p}\left(\frac{\Delta}{k}\right)\leq 12.$

So there are at most 12 admissible pairs $(m,n)$ and therefore there are at
most 12 admissible values of $q$ since $p$ is fixed. Thus,

$\\#\\{p^{-}<q<p^{+}:{\rm
disc}(\mathbb{Q}(\sqrt{D(p,q)}))\in{\mathcal{E}}_{\alpha}(4p)\\}\leq
12\\#{\mathcal{E}}_{\alpha}(4p)\ll p^{\frac{1}{5}},$

since $\alpha\geq 10$. Similarly, we have that

$\\#\\{p^{-}<q<p^{+}:{\rm
disc}(\mathbb{Q}(\sqrt{D(r,q)}))\in{\mathcal{E}}_{\alpha}(4r)\\}\leq
12\\#{\mathcal{E}}_{\alpha}(4r)\ll r^{\frac{1}{5}}\ll p^{\frac{1}{5}}$

and

$\displaystyle\\#\Big{\\{}p^{-}<q<p^{+}:{\rm
disc}(\mathbb{Q}(\sqrt{D(p,q)}))\in{\mathcal{E}}_{\alpha}(4p)\>{\rm and}\>{\rm
disc}(\mathbb{Q}(\sqrt{D(r,q)}))\in{\mathcal{E}}_{\alpha}(4r)\Big{\\}}$
$\displaystyle\leq
12\min\\{\\#{\mathcal{E}}_{\alpha}(4p),\\#{\mathcal{E}}_{\alpha}(4r)\\}\ll
p^{\frac{1}{5}}.$

Since $f_{1}\leq|D(p,q)|$ we have that

$\log\log f_{1}\leq(\log\log|D(p,q)|)\ll\log\log p\ll\log z.$

Thus, employing the bound
$\displaystyle{\frac{1}{\varphi(f_{1})}\ll\frac{\log\log f_{1}}{f_{1}}}$
yields

$\displaystyle\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
(f_{1},2)=1\end{subarray}}\frac{1}{\varphi(f_{1})}$ $\displaystyle\ll\log
z\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
(f_{1},2)=1\end{subarray}}\frac{1}{f_{1}}=\log
z\prod_{\begin{subarray}{c}\ell\mid D(p,q)\\\ \ell\neq
2\end{subarray}}\left(1-\frac{1}{\ell}\right)^{-1}\ll(\log z)^{2}.$ (4.6)

The result is analogous for $D(r,q)$ and then applying the bounds on the
exceptional set and the bound from $\eqref{varphibounds}$ in
$\eqref{stwoerror}$ yields

$S_{2}-S_{2}^{\prime}\ll_{\alpha}\frac{\sqrt{p}(\log
z)^{6}}{z^{1+\alpha}}+p^{\frac{1}{5}}(z(\log z)^{5}+z^{2}(\log z)^{4}),$

and since $\alpha\geq 10$ we conclude that
$S_{2}-S_{2}^{\prime}\ll_{\alpha}\displaystyle{\frac{\sqrt{p}}{\log p}}$.
Thus, it remains to show that

$S_{2}^{\prime}:=\sum_{p^{-}<q<p^{+}}\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
f_{2}|D(r,q)\\\
(f_{1}f_{2},2)=1\end{subarray}}\frac{L\left(1,\chi_{1};z^{8\alpha^{2}}\right)L\left(1,\chi_{2};z^{8\alpha^{2}}\right)}{\varphi(f_{1})\varphi(f_{2})}\ll\frac{\sqrt{p}}{\log
p}.$

In order to do this, we find an upper bound for
$L\left(1,\chi_{1};z^{8\alpha^{2}}\right)$. Recall that

$\chi_{1}:=\left(\frac{(2f_{1})^{2}D(p,q)}{\cdot}\right).$

By Mertens’ theorem, we have that

$\displaystyle L(1,\chi_{1};z^{8\alpha^{2}})$
$\displaystyle=\prod_{\ell\leq\sqrt{z}}\left(1-\frac{\chi_{1}(\ell)}{\ell}\right)^{-1}\prod_{\sqrt{z}\leq\ell\leq
z^{8\alpha^{2}}}\left(1-\frac{\chi_{1}(\ell)}{\ell}\right)^{-1}$
$\displaystyle\ll_{\alpha}\prod_{\ell\leq\sqrt{z}}\left(1-\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right)^{-1}\prod_{\begin{subarray}{c}\ell\leq\sqrt{z}\\\
\ell\mid
2f_{1}\end{subarray}}\left(1-\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right)$
$\displaystyle\ll_{\alpha}\frac{f_{1}}{\varphi(f_{1})}\prod_{\ell\leq\sqrt{z}}\left(1+\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right),$
(4.7)

and similarly,

$L(1,\chi_{2};z^{8\alpha^{2}})\ll_{\alpha}\frac{f_{2}}{\varphi(f_{2})}\prod_{\ell\leq\sqrt{z}}\left(1+\frac{\left(\frac{D(r,q)}{\ell}\right)}{\ell}\right).$
(4.8)

Since the products on the RHS of $\eqref{lshortfour}$ and $\eqref{lshortfive}$
no longer depend on $f_{1}$ and $f_{2}$ we swap the sum and product to obtain
the upper bound

$\displaystyle S_{2}^{\prime}\ll$
$\displaystyle\sum_{p^{-}<q<p^{+}}\prod_{\ell\leq\sqrt{z}}\left(1+\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right)\left(1+\frac{\left(\frac{D(r,q)}{\ell}\right)}{\ell}\right)\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
(f_{1},2)=1\end{subarray}}\frac{f_{1}}{\varphi^{2}(f_{1})}\sum_{\begin{subarray}{c}f_{2}|D(r,q)\\\
(f_{2},2)=1\end{subarray}}\frac{f_{2}}{\varphi^{2}(f_{2})}.$ (4.9)

We first consider the sum over $f_{1}$. Since
$\displaystyle{\frac{f_{1}}{\varphi^{2}(f_{1})}}$ is multiplicative by
Mertens’ theorem we have that

$\displaystyle\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
(f_{1},2)=1\end{subarray}}\frac{f_{1}}{\varphi^{2}(f_{1})}$
$\displaystyle=\prod_{\begin{subarray}{c}\ell|D(p,q)\\\ \ell\neq
2\end{subarray}}\left(1+\frac{\ell^{2}}{(\ell-1)^{3}}\right)\ll\prod_{\begin{subarray}{c}\ell|D(p,q)\\\
\ell\nmid
2f_{2}\end{subarray}}\left(1+\frac{1}{\ell}\right)\prod_{\begin{subarray}{c}\ell|(D(p,q),f_{2})\\\
\ell\neq 2\end{subarray}}\left(1+\frac{1}{\ell}\right)$
$\displaystyle\ll\frac{f_{2}}{\varphi(f_{2})}\prod_{\begin{subarray}{c}\ell|D(p,q)\\\
\ell\nmid
2f_{2}\end{subarray}}\left(1+\frac{1}{\ell}\right)=\frac{f_{2}}{\varphi(f_{2})}\prod_{\begin{subarray}{c}\ell|D(p,q)\\\
\ell\nmid 2f_{2}\\\ \ell\leq
z^{\alpha}\end{subarray}}\left(1+\frac{1}{\ell}\right)(1+O(z^{-\alpha+1}))$
$\displaystyle\ll\frac{f_{2}}{\varphi(f_{2})}\prod_{\begin{subarray}{c}\ell|D(p,q)\\\
\ell\nmid 2f_{2}\\\
\ell\leq\sqrt{z}\end{subarray}}\left(1+\frac{1}{\ell}\right)=\frac{f_{2}}{\varphi(f_{2})}\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
(f_{1},2f_{2})=1\\\
P^{+}(f_{1})\leq\sqrt{z}\end{subarray}}\frac{\mu^{2}(f_{1})}{f_{1}}.$ (4.10)

Replacing the RHS of $\eqref{coprimefone}$ in $\eqref{splustwo}$ yields

$S_{2}^{\prime}\ll\sum_{p^{-}<q<p^{+}}\prod_{\ell\leq\sqrt{z}}\left(1+\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right)\left(1+\frac{\left(\frac{D(r,q)}{\ell}\right)}{\ell}\right)\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
(f_{1},2)=1\\\
P^{+}(f_{1})\leq\sqrt{z}\end{subarray}}\frac{\mu^{2}(f_{1})}{f_{1}}\sum_{\begin{subarray}{c}f_{2}|D(r,q)\\\
(f_{2},2f_{1})=1\end{subarray}}\frac{f_{2}^{2}}{\varphi^{3}(f_{2})}.$ (4.11)

As in $\eqref{coprimefone}$ we have that

$\sum_{\begin{subarray}{c}f_{2}|D(r,q)\\\
(f_{2},2f_{1})=1\end{subarray}}\frac{f_{2}^{2}}{\varphi^{3}(f_{2})}=\prod_{\begin{subarray}{c}\ell|D(r,q)\\\
(\ell,2f_{1})=1\end{subarray}}\left(1+\frac{\ell^{3}}{(\ell-1)^{4}}\right)\ll\sum_{\begin{subarray}{c}f_{2}|D(r,q)\\\
(f_{2},2f_{1})=1\\\
P^{+}(f_{2})\leq\sqrt{z}\end{subarray}}\frac{\mu^{2}(f_{2})}{f_{2}}.$ (4.12)

Replacing $\eqref{coprimeftwo}$ in $\eqref{splustwoprime}$ yields

$\displaystyle S_{2}^{\prime}$
$\displaystyle\ll\sum_{p^{-}<q<p^{+}}\prod_{\ell\leq\sqrt{z}}\left(1+\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right)\left(1+\frac{\left(\frac{D(r,q)}{\ell}\right)}{\ell}\right)\sum_{\begin{subarray}{c}f_{1}|D(p,q)\\\
(f_{1},2)=1\\\
P^{+}(f_{1})\leq\sqrt{z}\end{subarray}}\frac{\mu^{2}(f_{1})}{f_{1}}\sum_{\begin{subarray}{c}f_{2}|D(r,q)\\\
(f_{2},2f_{1})=1\\\
P^{+}(f_{2})\leq\sqrt{z}\end{subarray}}\frac{\mu^{2}(f_{2})}{f_{2}}.$ (4.13)

Similar to $\eqref{lshortfour}$ we have that

$\displaystyle\prod_{\ell\leq\sqrt{z}}\left(1+\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right)\ll$
$\displaystyle\frac{f_{1}f_{2}}{\varphi(f_{1})\varphi(f_{2})}\prod_{\begin{subarray}{c}\ell\leq\sqrt{z}\\\
\ell\nmid
2f_{1}f_{2}\end{subarray}}\left(1+\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right),$
(4.14)

and

$\prod_{\ell\leq\sqrt{z}}\left(1+\frac{\left(\frac{D(r,q)}{\ell}\right)}{\ell}\right)\ll\frac{f_{1}f_{2}}{\varphi(f_{1})\varphi(f_{2})}\prod_{\begin{subarray}{c}\ell\leq\sqrt{z}\\\
\ell\nmid
2f_{1}f_{2}\end{subarray}}\left(1+\frac{\left(\frac{D(r,q)}{\ell}\right)}{\ell}\right).$
(4.15)

Combining $\eqref{splusthree},\eqref{lshortsix},$ and $\eqref{lshortseven}$
gives

$\displaystyle S_{2}^{\prime}$
$\displaystyle\ll\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}p^{-}<q<p^{+}\\\
f_{1}|D(p,q)\\\
f_{2}|D(r,q)\end{subarray}}\prod_{\begin{subarray}{c}\ell\leq\sqrt{z}\\\
\ell\nmid
2f_{1}f_{2}\end{subarray}}\left(1+\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right)\left(1+\frac{\left(\frac{D(r,q)}{\ell}\right)}{\ell}\right).$
(4.16)

We have that

$\prod_{\begin{subarray}{c}\ell\leq\sqrt{z}\\\ \ell\nmid
2f_{1}f_{2}\end{subarray}}\left(1+\frac{\left(\frac{D(p,q)}{\ell}\right)}{\ell}\right)=\sum_{\begin{subarray}{c}P^{+}(n_{1})\leq\sqrt{z}\\\
(n_{1},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})}{n_{1}}\left(\frac{D(p,q)}{n_{1}}\right),$
(4.17)

and likewise

$\prod_{\begin{subarray}{c}\ell\leq\sqrt{z}\\\ \ell\nmid
2f_{1}f_{2}\end{subarray}}\left(1+\frac{\left(\frac{D(r,q)}{\ell}\right)}{\ell}\right)=\sum_{\begin{subarray}{c}P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{2})}{n_{2}}\left(\frac{D(r,q)}{n_{2}}\right).$
(4.18)

Combining $\eqref{splusfour}$ with $\eqref{eulerposione}$ and
$\eqref{eulerpositwo}$ and breaking up the RHS of $\eqref{splusfour}$ into
sums over primes $q\mid 2f_{1}f_{2}n_{1}n_{2}$ and $q\nmid
2f_{1}f_{2}n_{1}n_{2}$ yields

$\displaystyle S_{2}^{\prime}\ll$
$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}}$
$\displaystyle\times$ $\displaystyle\sum_{\begin{subarray}{c}p^{-}<q<p^{+}\\\
f_{1}|D(p,q),f_{2}|D(r,q)\\\
(q,2f_{1}f_{2}n_{1}n_{2})=1\end{subarray}}\left(\frac{D(p,q)}{n_{1}}\right)\left(\frac{D(r,q)}{n_{2}}\right)$
$\displaystyle+$
$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}}$
$\displaystyle\times$ $\displaystyle\sum_{\begin{subarray}{c}p^{-}<q<p^{+}\\\
f_{1}|D(p,q),f_{2}|D(r,q)\\\ q\mid
2f_{1}f_{2}n_{1}n_{2}\end{subarray}}\left(\frac{D(p,q)}{n_{1}}\right)\left(\frac{D(r,q)}{n_{2}}\right).$
(4.19)

We have that the second sum in $\eqref{splusacop}$ is bounded by

$\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}\tau(f_{1})\tau(f_{2})}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})\tau(n_{1}n_{2})}{n_{1}n_{2}},$
(4.20)

where $\tau(n)$ denotes the number of divisors of $n$. We have that
$\tau(n_{1}n_{2})\leq\tau(n_{1})\tau(n_{2})$ and

$\displaystyle\sum_{\begin{subarray}{c}P^{+}(n),\leq\sqrt{z}\\\
(n,2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n)\tau(n)}{n}$
$\displaystyle=\prod_{\begin{subarray}{c}\ell\leq\sqrt{z}\\\ \ell\nmid
2f_{1}f_{2}\end{subarray}}\left(1+\frac{2}{\ell}\right)\ll(\log z)^{2},$
(4.21)

by Mertens’ theorem and similarly,

$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f),\leq\sqrt{z}\\\
(f,2)=1\end{subarray}}\frac{\mu^{2}(f)f\tau(f)}{\varphi^{2}(f)}$
$\displaystyle=\prod_{\begin{subarray}{c}\ell\leq\sqrt{z}\\\ \ell\nmid
2\end{subarray}}\left(1+\frac{2\ell}{(\ell-1)^{2}}\right)\ll(\log z)^{2}.$
(4.22)

Thus, from $\eqref{tauonebound}$ and $\eqref{tautwobound}$ we have that
$\eqref{sanotcop}$ is bounded by $(\log z)^{8}$ and we conclude that the
second term in $\eqref{splusacop}$ is smaller than
$\displaystyle{\frac{\sqrt{p}}{\log p}}$. Thus, it remains to show

$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}}$
$\displaystyle\times$ $\displaystyle\sum_{\begin{subarray}{c}p^{-}<q<p^{+}\\\
f_{1}|D(p,q),f_{2}|D(r,q)\\\
(q,2f_{1}f_{2}n_{1}n_{2})=1\end{subarray}}\left(\frac{D(p,q)}{n_{1}}\right)\left(\frac{D(r,q)}{n_{2}}\right)\ll\frac{\sqrt{p}}{\log
p}.$ (4.23)

Let $\lambda^{+}$ be the function defined in the fundamental lemma of sieve
methods, Lemma 2.6 with $y=p^{\frac{1}{6}}$ and $D=y^{2}$. Then we have that
the LHS of $\eqref{splusfourcop}$ is less than or equal to

$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}}$
$\displaystyle\times$ $\displaystyle\sum_{\begin{subarray}{c}p^{-}\leq m\leq
p^{+}\\\ f_{1}\mid D(p,m),f_{2}\mid D(r,m)\\\
(m,2f_{1}f_{2}n_{1}n_{2})=1\end{subarray}}(\lambda^{+}*1)(m)\left(\frac{D(p,m)}{n_{1}}\right)\left(\frac{D(r,m)}{n_{2}}\right),$
(4.24)

by the positivity of the Euler product in $\eqref{eulerposione}$ and
$\eqref{eulerpositwo}$. Hence, $\eqref{sprimewithm}$ becomes

$\displaystyle S_{3}:=$
$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}}$
$\displaystyle\times$ $\displaystyle\sum_{\begin{subarray}{c}a\leq D\\\
(a,2f_{1}f_{2}n_{1}n_{2})=1\end{subarray}}\lambda^{+}(a)\sum_{\begin{subarray}{c}p^{-}<m<p^{+}\\\
f_{1}\mid D(p,m),f_{2}\mid D(r,m)\\\ a\mid
m\end{subarray}}\left(\frac{D(p,m)}{n_{1}}\right)\left(\frac{D(r,m)}{n_{2}}\right).$
(4.25)

Now we split the integers in the interval $m\in(p^{-},p^{+})$ according to the
congruence class of $D(p,m)\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,n_{1})$ and $D(r,m)\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,n_{2})$. Thus, $\eqref{sprimefour}$ becomes

$\displaystyle S_{3}=$
$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}}$
$\displaystyle\times$ $\displaystyle\sum_{\begin{subarray}{c}a\leq D\\\
(a,2f_{1}f_{2}n_{1}n_{2})=1\end{subarray}}\lambda^{+}(a)\sum_{\begin{subarray}{c}b_{1}\in\mathbb{Z}/n_{1}\mathbb{Z}\\\
b_{2}\in\mathbb{Z}/n_{2}\mathbb{Z}\end{subarray}}\left(\frac{b_{1}}{n_{1}}\right)\left(\frac{b_{2}}{n_{2}}\right)S(a,f_{1},f_{2},n_{1},n_{2},b_{1},b_{2}),$

where

$S(a,f_{1},f_{2},n_{1},n_{2},b_{1},b_{2}):=\\#\left\\{\begin{array}[]{ll}&D(p,m)\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,f_{1})\\\ &D(r,m)\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,f_{2})\\\
p^{-}<m<p^{+};&D(p,m)\equiv b_{1}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,n_{1})\\\ &D(r,m)\equiv b_{2}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,n_{2})\\\ &m\equiv 0\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,a)\end{array}\right\\}.$

Since $a,f_{1},f_{2}$,and $[n_{1},n_{2}]$ are all coprime we have that

$\displaystyle S(a,f_{1},f_{2},n_{1},n_{2},b_{1},b_{2})$
$\displaystyle=\left(\frac{4\sqrt{p}}{af_{1}f_{2}[n_{1},n_{2}]}\right)\\#T(a,f_{1},f_{2},n_{1},n_{2},b_{1},b_{2})$
$\displaystyle+O(\\#T(a,f_{1},f_{2},n_{1},n_{2},b_{1},b_{2})),$ (4.26)

where

$T(a,f_{1},f_{2},n_{1},n_{2},b_{1},b_{2}):=\left\\{\begin{array}[]{ll}&D(p,m)\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,f_{1})\\\ &D(r,m)\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,f_{2})\\\
m\in\mathbb{Z}/af_{1}f_{2}[n_{1},n_{2}]\mathbb{Z};&D(p,m)\equiv
b_{1}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,n_{1})\\\ &D(r,m)\equiv
b_{2}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,n_{2})\\\ &m\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,a)\end{array}\right\\}.$

Therefore, we have from $\eqref{sprimeest}$ that $\eqref{sprimefour}$ becomes

$\displaystyle S_{3}=$ $\displaystyle
4\sqrt{p}\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}[n_{1},n_{2}]}$
$\displaystyle\times$ $\displaystyle\sum_{\begin{subarray}{c}a\leq D\\\
(a,2f_{1}f_{2}n_{1}n_{2})=1\end{subarray}}\frac{\lambda^{+}(a)}{a}\sum_{\begin{subarray}{c}b_{1}\in\mathbb{Z}/n_{1}\mathbb{Z}\\\
b_{2}\in\mathbb{Z}/n_{2}\mathbb{Z}\end{subarray}}\left(\frac{b_{1}}{n_{1}}\right)\left(\frac{b_{2}}{n_{2}}\right)\\#T(a,f_{1},f_{2},n_{1},n_{2},b_{1},b_{2})$
$\displaystyle+$ $\displaystyle
O\Bigg{(}\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}}$
$\displaystyle\times$ $\displaystyle\sum_{\begin{subarray}{c}a\leq D\\\
(a,2f_{1}f_{2}n_{1}n_{2})=1\end{subarray}}|\lambda^{+}(a)|\sum_{\begin{subarray}{c}b_{1}\in\mathbb{Z}/n_{1}\mathbb{Z}\\\
b_{2}\in\mathbb{Z}/n_{2}\mathbb{Z}\end{subarray}}\\#T(a,f_{1},f_{2},n_{1},n_{2},b_{1},b_{2})\Bigg{)}.$
(4.27)

By the Chinese remainder theorem we have that

$\\#T(a,f_{1},f_{2},n_{1},n_{2},b_{1},b_{2})=\\#T(a)\\#T(f_{1})\\#T(f_{2})\prod_{\ell\mid[n_{1},n_{2}]}\\#T^{(\ell)}(n_{1},n_{2},b_{1},b_{2}),$

where

$\displaystyle\\#T(a):=$
$\displaystyle\\#\\{m\in\mathbb{Z}/a\mathbb{Z}:m\equiv 0\allowbreak\mkern
7.0mu({\operator@font mod}\,\,a)\\}=1,$ $\displaystyle\\#T(f_{1}):=$
$\displaystyle\\#\\{m\in\mathbb{Z}/f_{1}\mathbb{Z}:D(p,m)\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,f_{1})\\},$
$\displaystyle\\#T(f_{2}):=$
$\displaystyle\\#\\{m\in\mathbb{Z}/f_{2}\mathbb{Z}:D(r,m)\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,f_{2})\\},$
$\displaystyle\\#T^{(\ell)}(n_{1},n_{2},b_{1},b_{2}):=$
$\displaystyle\\#\Bigg{\\{}m\in\mathbb{Z}/\ell^{\nu_{\ell}([n_{1},n_{2}])}\mathbb{Z}:D(p,m)\equiv
b_{1}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,\ell^{\nu_{\ell}(n_{1})})$ $\displaystyle\quad{\rm and}\>D(r,m)\equiv
b_{2}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,\ell^{\nu_{\ell}(n_{2})})\Bigg{\\}}.$ (4.28)

Note that $T(f_{i})$ is multiplicative for $i=1,2$ and since we sum over odd,
square-free $f_{i}$ in $\eqref{sprimefive}$ we have that

$\displaystyle\\#T(f_{1})=\prod_{\ell\mid
f_{1}}\\#\\{m\in\mathbb{Z}/\ell\mathbb{Z}:(p+1-m)^{2}\equiv
4p\allowbreak\mkern 7.0mu({\operator@font mod}\,\,\ell)\\}=$
$\displaystyle\prod_{\ell\mid
f_{1}}\left(1+\left(\frac{p}{\ell}\right)\right)=\sum_{d\mid
f_{1}}\mu^{2}(d)\left(\frac{p}{d}\right)$ (4.29)

and similarly,

$\\#T(f_{2})=\prod_{\ell\mid
f_{2}}\left(1+\left(\frac{r}{\ell}\right)\right)=\sum_{d\mid
f_{2}}\mu^{2}(d)\left(\frac{r}{d}\right).$

Thus, $\\#T(f_{i})\leq\tau(f_{i})$ for all square-free integers $f_{i}$ for
$i=1,2$. Now we consider the following function

$c(n_{1},n_{2}):=\sum_{\begin{subarray}{c}b_{1}\in\mathbb{Z}/n_{1}\mathbb{Z}\\\
b_{2}\in\mathbb{Z}/n_{2}\mathbb{Z}\end{subarray}}\left(\frac{b_{1}}{n_{1}}\right)\left(\frac{b_{2}}{n_{2}}\right)\prod_{\ell\mid[n_{1},n_{2}]}\\#T^{(\ell)}(n_{1},n_{2},b_{1},b_{2}).$

Suppose that
$n_{1}=n_{1}^{\prime}n_{1}^{\prime\prime},n_{2}=n_{2}^{\prime}n_{2}^{\prime\prime}$
and
$(n_{1}^{\prime}n_{2}^{\prime},n_{1}^{\prime\prime}n_{2}^{\prime\prime})=1$.
Then by the Chinese remainder theorem we have that

$\displaystyle
c(n_{1}^{\prime}n_{1}^{\prime\prime},n_{2}^{\prime}n_{2}^{\prime\prime})$
$\displaystyle=\sum_{\begin{subarray}{c}b_{1}\in\mathbb{Z}/n_{1}^{\prime}n_{1}^{\prime\prime}\mathbb{Z}\\\
b_{2}\in\mathbb{Z}/n_{2}^{\prime}n_{2}^{\prime\prime}\mathbb{Z}\end{subarray}}\left(\frac{b_{1}}{n_{1}^{\prime}n_{1}^{\prime\prime}}\right)\left(\frac{b_{2}}{n_{2}^{\prime}n_{2}^{\prime\prime}}\right)\prod_{\ell\mid[n_{1}^{\prime}n_{1}^{\prime\prime},n_{2}^{\prime}n_{2}^{\prime\prime}]}\\#T^{(\ell)}(n_{1}^{\prime}n_{1}^{\prime\prime},n_{2}^{\prime}n_{2}^{\prime\prime},b_{1},b_{2})$
$\displaystyle=\sum_{\begin{subarray}{c}b_{1}^{\prime}\in\mathbb{Z}/n_{1}^{\prime}\mathbb{Z}\\\
b_{2}^{\prime}\in\mathbb{Z}/n_{2}^{\prime}\mathbb{Z}\end{subarray}}\left(\frac{b_{1}^{\prime}}{n_{1}^{\prime}}\right)\left(\frac{b_{2}^{\prime}}{n_{2}^{\prime}}\right)\prod_{\ell\mid[n_{1}^{\prime},n_{2}^{\prime}]}\\#T^{(\ell)}(n_{1}^{\prime},n_{2}^{\prime},b_{1}^{\prime},b_{2}^{\prime})$
$\displaystyle\times\sum_{\begin{subarray}{c}b_{1}^{\prime\prime}\in\mathbb{Z}/n_{1}^{\prime\prime}\mathbb{Z}\\\
b_{2}^{\prime\prime}\in\mathbb{Z}/n_{2}^{\prime\prime}\mathbb{Z}\end{subarray}}\left(\frac{b_{1}^{\prime\prime}}{n_{1}^{\prime\prime}}\right)\left(\frac{b_{2}^{\prime\prime}}{n_{2}^{\prime\prime}}\right)\prod_{\ell\mid[n_{1}^{\prime\prime},n_{2}^{\prime\prime}]}\\#T^{(\ell)}(n_{1}^{\prime\prime},n_{2}^{\prime\prime},b_{1}^{\prime\prime},b_{2}^{\prime\prime})$
$\displaystyle=c(n_{1}^{\prime},n_{2}^{\prime})c(n_{1}^{\prime\prime},n_{2}^{\prime\prime}).$

Thus, $c(n_{1},n_{2})$ is multiplicative and
$[n_{1}^{\prime}n_{1}^{\prime\prime},n_{2}^{\prime}n_{2}^{\prime\prime}]=[n_{1}^{\prime},n_{2}^{\prime}][n_{1}^{\prime\prime},n_{2}^{\prime\prime}]$.
We have that $n_{1},n_{2}$ runs over square-free integers with
$(n_{1}n_{2},2f_{1}f_{2})=1$ so it is enough to calculate $c(n_{1},n_{2})$ for
primes $\ell\nmid 2f_{1}f_{2}$. Since $c(1,1)=1$, we have three cases to
consider, namely $c(\ell,1),c(1,\ell)$, and $c(\ell,\ell)$.

The cases $c(\ell,1)$ and $c(1,\ell)$ are completely similar and we have from
$\eqref{tellsum}$ and $\eqref{huvbound}$ that

$\displaystyle c(\ell,1)$
$\displaystyle=\sum_{b_{1}\in\mathbb{Z}/\ell\mathbb{Z}}\left(\frac{b_{1}}{\ell}\right)\\#\\{m\in\mathbb{Z}/\ell\mathbb{Z}:(p+1-m)^{2}\equiv
4p+b_{1}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,\ell)\\}$
$\displaystyle=\sum_{b_{1}\in\mathbb{Z}/\ell\mathbb{Z}}\left(\frac{b_{1}}{\ell}\right)\left(1+\left(\frac{4p+b_{1}}{\ell}\right)\right)=\sum_{b_{1}\in\mathbb{Z}/\ell\mathbb{Z}}\left(\frac{b_{1}}{\ell}\right)\left(\frac{4p+b_{1}}{\ell}\right)$
$\displaystyle=\sum_{b_{1}\in\mathbb{Z}/\ell\mathbb{Z}}\left(\frac{b_{1}^{2}+4pb_{1}}{\ell}\right)=c(1,\ell).$

From [Ste, Exercise 1.1.9] we have for $a\not\equiv 0\allowbreak\mkern
7.0mu({\operator@font mod}\,\,\ell)$ that

$\sum_{t\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,\ell)}\left(\frac{at^{2}+bt+c}{\ell}\right)=\left\\{\begin{array}[]{ll}\left(\frac{a}{\ell}\right)(\ell-1)&{\rm
if}\>b^{2}-4ac\equiv 0\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,\ell),\\\ -\left(\frac{a}{\ell}\right)&{\rm if}\>b^{2}-4ac\not\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,\ell).\end{array}\right.$

Thus,

$c(\ell,1)=\left\\{\begin{array}[]{ll}\ell-1&{\rm if}\>16p^{2}\equiv
0\allowbreak\mkern 7.0mu({\operator@font mod}\,\,\ell),\\\ -1&{\rm
if}\>16p^{2}\not\equiv 0\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,\ell).\end{array}\right.$

However, $\ell\nmid 2$ so if $16p^{2}\equiv 0\allowbreak\mkern
7.0mu({\operator@font mod}\,\,\ell)$ then $\ell=p$. Since
$P^{+}(n_{1})\leq\sqrt{z}=\sqrt{\log 4p}<p$, we have that
$c(\ell,1)=c(1,\ell)=-1$.

In the $c(\ell,\ell)$ case we have that

$c(\ell,\ell)=\sum_{b_{1},b_{2}\in\mathbb{Z}/\ell\mathbb{Z}}\left(\frac{b_{1}b_{2}}{\ell}\right)\\#\\{m\in\mathbb{Z}/\ell\mathbb{Z}:D(p,m)\equiv
b_{1}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,\ell)\>{\rm
and}\>D(r,m)\equiv b_{2}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,\ell)\\}.$

We remark that there are at most two solutions to the equation $D(p,m)\equiv
b_{1}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,\ell)$ since $D(p,m)$ is
a quadratic polynomial in $m$. Let $m_{0}$ be one such solution. If
$D(r,m_{0})\not\equiv b_{2}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,\ell)$ then the two equations are not compatible. If $D(r,m_{0})\equiv
b_{2}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,\ell)$ then since the
trace of $D(r,m)$ is fixed there will be at most $2$ values of $b_{2}$ that
satisfy this equation. Hence,

$|c(\ell,\ell)|\leq\sum_{b_{1}\in\mathbb{Z}/\ell\mathbb{Z}}2=2\ell.$

Combining the three cases, we conclude that

$|c(n_{1},n_{2})|\leq\prod_{\ell\mid(n_{1},n_{2})}|c(\ell,\ell)|\leq\prod_{\ell\mid(n_{1},n_{2})}2\ell=2^{\omega((n_{1},n_{2}))}(n_{1},n_{2}).$

We now place our bounds from $\eqref{huvbound}$ and $c(n_{1},n_{2})$ into
$\eqref{sprimefive}$ and we have that

$\displaystyle S_{3}\ll$
$\displaystyle\sqrt{p}\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})\tau(f_{1})\tau(f_{2})}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})(n_{1},n_{2})^{2}}{(n_{1}n_{2})^{2-\epsilon}}$
$\displaystyle\times$ $\displaystyle\Bigg{|}\sum_{\begin{subarray}{c}a\leq
D\\\
(a,2f_{1}f_{2}n_{1}n_{2})=1\end{subarray}}\frac{\lambda^{+}(a)}{a}\Bigg{|}+D\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})f_{1}f_{2}\tau(f_{1})\tau(f_{2})}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}$
$\displaystyle\times$
$\displaystyle\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}}\sum_{\begin{subarray}{c}b_{1}\in\mathbb{Z}/n_{1}\mathbb{Z}\\\
b_{2}\in\mathbb{Z}/n_{2}\mathbb{Z}\end{subarray}}\prod_{\ell\mid[n_{1},n_{2}]}\\#T^{(\ell)}(n_{1},n_{2},b_{1},b_{2}).$
(4.30)

We first consider the second sum in $\eqref{sprimesix}$. Similarly to the
function $c(n_{1},n_{2})$ defined above, the function

$k(n_{1},n_{2}):=\sum_{\begin{subarray}{c}b_{1}\in\mathbb{Z}/n_{1}\mathbb{Z}\\\
b_{2}\in\mathbb{Z}/n_{2}\mathbb{Z}\end{subarray}}\prod_{\ell\mid[n_{1},n_{2}]}\\#T^{(\ell)}(n_{1},n_{2},b_{1},b_{2})$

is also multiplicative in $n_{1}$ and $n_{2}$. We have $k(1,1)=1,$

$k(\ell,1)=\sum_{b_{1}\in\mathbb{Z}/\ell\mathbb{Z}}\left(1+\left(\frac{4p+b_{1}}{\ell}\right)\right)=\ell=k(1,\ell),$

and as in the case $c(\ell,\ell)$ above, we have that
$|k(\ell,\ell)|\leq\sum_{b_{1}\in\mathbb{Z}/\ell\mathbb{Z}}2=2\ell.$ Thus,

$|k(n_{1},n_{2})|\leq\prod_{\ell\mid[n_{1},n_{2}]}|k(\ell,1)k(1,\ell)k(\ell,\ell)|\leq\prod_{\ell\mid[n_{1},n_{2}]}2\ell^{3}=2^{\omega([n_{1},n_{2}])}[n_{1},n_{2}]^{3}.$

Substituting the bound above in $\eqref{sprimesix}$ we have that

$\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})}{n_{1}n_{2}}2^{\omega([n_{1},n_{2}])}[n_{1},n_{2}]^{3}\ll
z^{3+\epsilon},$

for $\epsilon>0$. Then by Mertens’ theorem, for $i=1,2$ we have that

$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f_{i})\leq\sqrt{z}\\\
(f_{i},2)=1\end{subarray}}\frac{\mu^{2}(f_{i})\tau(f_{i})f_{i}}{\varphi^{2}(f_{i})}\ll\frac{\sqrt{z}}{\log
z}\prod_{\ell\leq\sqrt{z}}\left(1+\frac{2}{(\ell-1)^{2}}\right)\ll\frac{\sqrt{z}}{\log
z},$

and thus, the second term in $\eqref{sprimesix}$ is bounded by
$Dz^{4+\epsilon}$. Then from Lemma 2.6 we have that $\eqref{sprimesix}$
becomes

$\displaystyle S_{3}\ll$
$\displaystyle\sqrt{p}\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})\tau(f_{1})\tau(f_{2})}{\varphi^{2}(f_{1})\varphi^{2}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})(n_{1},n_{2})^{2}}{n_{1}^{2-\epsilon}n_{2}^{2-\epsilon}}$
$\displaystyle\times$ $\displaystyle\prod_{\begin{subarray}{c}\ell\leq y\\\
\ell\nmid
2f_{1}f_{2}n_{1}n_{2}\end{subarray}}\left(1-\frac{1}{\ell}\right)+Dz^{4+\epsilon}.$
(4.31)

By Mertens’ theorem we have that

$\prod_{\begin{subarray}{c}\ell\leq y\\\ \ell\nmid
2f_{1}f_{2}n_{1}n_{2}\end{subarray}}\left(1-\frac{1}{\ell}\right)\ll\frac{f_{1}f_{2}n_{1}n_{2}}{\varphi(f_{1})\varphi(f_{2})\varphi(n_{1})\varphi(n_{2})\log
y},$

and therefore the first term in the RHS of $\eqref{sprimeseven}$ is bounded by

$\displaystyle\frac{\sqrt{p}}{\log
y}\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})\tau(f_{1})\tau(f_{2})f_{1}f_{2}}{\varphi^{3}(f_{1})\varphi^{3}(f_{2})}\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})(n_{1},n_{2})^{2}}{\varphi(n_{1})\varphi(n_{2})n_{1}^{1-\epsilon}n_{2}^{1-\epsilon}}.$

We have that

$\displaystyle\sum_{\begin{subarray}{c}P^{+}(n_{1}),P^{+}(n_{2})\leq\sqrt{z}\\\
(n_{1}n_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(n_{1})\mu^{2}(n_{2})(n_{1},n_{2})^{2}}{\varphi(n_{1})\varphi(n_{2})n_{1}^{1-\epsilon}n_{2}^{1-\epsilon}}$
$\displaystyle\ll$
$\displaystyle\sum_{\begin{subarray}{c}P^{+}(d)\leq\sqrt{z}\\\
(d,2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(d)}{d^{2-2\epsilon}}\sum_{\begin{subarray}{c}P^{+}(m_{1}),P^{+}(m_{2})\leq\frac{\sqrt{z}}{d}\\\
n_{1}=dm_{1},n_{2}=dm_{2}\\\ (d,m_{1}m_{2})=1\\\
(m_{1}m_{2},2f_{1}f_{2})=1\end{subarray}}\frac{\mu^{2}(m_{1})\mu^{2}(m_{2})(\log\log
dm_{1})(\log\log dm_{2})}{m_{1}^{2-\epsilon}m_{2}^{2-\epsilon}}\ll 1,$

and

$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f_{1}),P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{1},2)=(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{1})\mu^{2}(f_{2})\tau(f_{1})\tau(f_{2})f_{1}f_{2}}{\varphi^{3}(f_{1})\varphi^{3}(f_{2})}$
$\displaystyle\ll$
$\displaystyle\sum_{\begin{subarray}{c}P^{+}(f_{1})\leq\sqrt{z}\\\
(f_{1},2)=1\end{subarray}}\frac{\mu^{2}(f_{1})\tau(f_{1})(\log\log
f_{1})^{3}}{f_{1}^{2}}\sum_{\begin{subarray}{c}P^{+}(f_{2})\leq\sqrt{z}\\\
(f_{2},2f_{1})=1\end{subarray}}\frac{\mu^{2}(f_{2})\tau(f_{2})(\log\log
f_{2})^{3}}{f_{2}^{2}}\ll 1.$

Thus, we conclude that

$S_{2}\ll S_{2}^{\prime}\ll S_{3}\ll\frac{\sqrt{p}}{\log y}+D(\log
4p)^{4+\epsilon}\ll\frac{\sqrt{p}}{\log p},$

for $y=p^{\frac{1}{6}},D=(p^{\frac{1}{6}})^{2}=p^{\frac{1}{3}},$ which
completes the proof. ∎

The proof of Proposition 3.3 follows completely analogously to the steps taken
in Proposition 3.2 and is essentially a special case of Chandee, David,
Koukoulopoulos and Smith [CDKS, Proposition 4.1].

##  5\. A short length of the average

###### Proof.

(Proof of Lemma 3.4) Let $\chi_{i}$ and $\chi_{i}^{\prime}$ be Dirichlet
characters modulo $p_{i}$ for $1\leq i\leq L$ and let $\chi_{0}$ denote the
principal character modulo $n$ for any integer $n$. For a Dirichlet character
$\chi\allowbreak\mkern 7.0mu({\operator@font mod}\,\,n)$, let $\bar{\chi}$
denote its complex conjugate of $\chi$ and let

${\mathcal{A}}(\chi):=\sum_{|a|\leq A}\chi(a)\quad{\rm
and}\quad{\mathcal{B}}(\chi):=\sum_{|b|\leq B}\chi(b).$

We recall from $\eqref{rpst}$ that $R(P,S,T)$ is the number of integers
$|a|\leq A,|b|\leq B$ such that there exists a vector
$(u_{1},\ldots,u_{L})\in\mathbb{F}_{p_{1}}^{*}\times\cdots\times\mathbb{F}_{p_{L}}^{*}$
satisfying

$a\equiv s_{i}u_{i}^{4}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{i}),\quad b\equiv t_{i}u_{i}^{6}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\quad{\rm for}\>1\leq i\leq L.$

For $P:=(p_{1},\ldots,p_{L}),S:=(s_{1},\ldots,s_{L}),T:=(t_{1},\ldots,t_{L})$,
and $U:=(u_{1},\ldots,u_{L})$ we have that

$\displaystyle R(P,S,T)=$ $\displaystyle\sum_{\begin{subarray}{c}|a|\leq
A,|b|\leq B\\\ \exists\;U\in\mathbb{F}(P)^{*}\\\ a\equiv
s_{i}u_{i}^{4}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i}),b\equiv
t_{i}u_{i}^{6}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i})\\\ 1\leq
i\leq L\end{subarray}}1$ $\displaystyle=$
$\displaystyle\frac{1}{2^{L}}\sum_{\begin{subarray}{c}|a|\leq A\\\ |b|\leq
B\end{subarray}}\sum_{U\in\mathbb{F}(P)^{*}}\prod_{i=1}^{L}\Bigg{(}\frac{1}{\varphi(p_{i})^{2}}\sum_{\chi_{i}\allowbreak\mkern
7.0mu({\operator@font
mod}\,\,p_{i})}\chi_{i}(s_{i}u_{i}^{4})\overline{\chi_{i}}(a)\sum_{\chi_{i}^{\prime}\allowbreak\mkern
7.0mu({\operator@font
mod}\,\,p_{i})}\chi_{i}^{\prime}(t_{i}u_{i}^{6})\overline{\chi_{i}^{\prime}}(b)\Bigg{)}$
$\displaystyle=$
$\displaystyle\frac{1}{2^{L}}\prod_{i=1}^{L}\frac{1}{(p_{i}-1)^{2}}\sum_{U\in\mathbb{F}(P)^{*}}\sum_{\begin{subarray}{c}\chi_{i},\chi_{i}^{\prime}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ 1\leq i\leq
L\end{subarray}}\chi_{i}(s_{i})\chi_{i}^{\prime}(t_{i})\chi_{i}(u_{i}^{4})\chi_{i}^{\prime}(u_{i}^{6})$
$\displaystyle\times$ $\displaystyle\sum_{\begin{subarray}{c}|a|\leq A\\\
|b|\leq
B\end{subarray}}\overline{\chi_{1}\cdots\chi_{L}}(a)\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}}(b).$
(5.1)

In $\eqref{suv}$ the factor $2^{-L}$ is present, since if there exists a
$u_{i}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i})$ such that
$a\equiv s_{i}u_{i}^{4}\allowbreak\mkern 7.0mu({\operator@font mod}\,\,p_{i})$
and $b\equiv t_{i}u_{i}^{6}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{i})$ then there exists exactly two such $u_{i}$, namely $\pm
u_{i}$.

By the orthogonality of Dirichlet characters, we have that the sum over $U$
becomes

$\prod_{i=1}^{L}\sum_{U\in\mathbb{F}_{p_{i}}^{*}}\chi_{i}(u_{i}^{4})\chi_{i}^{\prime}(u_{i}^{6})=\begin{cases}\prod_{i=1}^{L}(p_{i}-1)&\>{\rm
if}\>\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\>{\rm for}\>1\leq i\leq L,\\\ 0&\>{\rm
otherwise}.\end{cases}$ (5.2)

Then from $\eqref{suv}$ and $\eqref{suvtwo}$ we have that

$\displaystyle R(P,S,T)=$
$\displaystyle\frac{1}{2^{L}}\sum_{\begin{subarray}{c}\chi_{1},\ldots,\chi_{L}\\\
\chi_{1}^{\prime},\ldots,\chi_{L}^{\prime}\\\
\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq
L\end{subarray}}\prod_{i=1}^{L}\left(\frac{\chi_{i}(s_{i})\chi_{i}^{\prime}(t_{i})}{p_{i}-1}\right){\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}}){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})$
$\displaystyle=$
$\displaystyle\frac{1}{2^{L}}\Bigg{[}\sum_{\begin{subarray}{c}\chi_{i}=\chi_{i}^{\prime}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq
L\end{subarray}}+\sum_{\begin{subarray}{c}\chi_{i}=(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm
s.t.}\>\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}+\sum_{\begin{subarray}{c}\chi_{i}^{\prime}=\chi_{i}^{4}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm s.t.}\>\chi_{j}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{j})\end{subarray}}$ $\displaystyle+$
$\displaystyle\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}\Bigg{]}\prod_{i=1}^{L}\left(\frac{\chi_{i}(s_{i})\chi_{i}^{\prime}(t_{i})}{p_{i}-1}\right){\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}}){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}}).$
(5.3)

We denote the four sums in $\eqref{thefourcs}$ as follows,

$\displaystyle R_{1}(P,S,T)$
$\displaystyle:=\frac{1}{2^{L}}\sum_{\begin{subarray}{c}\chi_{i}=\chi_{i}^{\prime}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq
L\end{subarray}}\prod_{i=1}^{L}\left(\frac{\chi_{i}(s_{i})\chi_{i}^{\prime}(t_{i})}{p_{i}-1}\right){\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}}){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}}),$
$\displaystyle R_{2}(P,S,T)$
$\displaystyle:=\frac{1}{2^{L}}\sum_{\begin{subarray}{c}\chi_{i}=(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm
s.t.}\>\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}\prod_{i=1}^{L}\left(\frac{\chi_{i}(s_{i})\chi_{i}^{\prime}(t_{i})}{p_{i}-1}\right){\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}}){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}}),$
$\displaystyle R_{3}(P,S,T)$
$\displaystyle:=\frac{1}{2^{L}}\sum_{\begin{subarray}{c}\chi_{i}^{\prime}=\chi_{i}^{4}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm s.t.}\>\chi_{j}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}\prod_{i=1}^{L}\left(\frac{\chi_{i}(s_{i})\chi_{i}^{\prime}(t_{i})}{p_{i}-1}\right){\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}}){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}}),$
$\displaystyle R_{4}(P,S,T)$
$\displaystyle:=\frac{1}{2^{L}}\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}\prod_{i=1}^{L}\left(\frac{\chi_{i}(s_{i})\chi_{i}^{\prime}(t_{i})}{p_{i}-1}\right){\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}}){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}}).$

We recall the LHS of $\eqref{lemerrorbound}$,

$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)\left(R(P,S,T)-\frac{AB}{2^{L-2}p_{1}\cdots
p_{L}}\right)$ $\displaystyle=$ $\displaystyle\sum_{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)\left(\sum_{j=1}^{4}R_{j}(P,S,T)-\frac{AB}{2^{L-2}p_{1}\cdots
p_{L}}\right),$

by rewriting $R(P,S,T)$ as in $\eqref{thefourcs}$.

For $R_{1}(P,S,T)$ we have that
$\chi_{i}=\chi_{i}^{\prime}=\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{i})$ for $1\leq i\leq L$ and hence,

$\displaystyle{\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}})$
$\displaystyle=\sum_{|a|\leq A}\chi_{0}(a)=\sum_{\begin{subarray}{c}|a|\leq
A\\\ (a,p_{1}\cdots p_{L})=1\end{subarray}}1=2A\frac{\varphi(p_{1}\cdots
p_{L})}{p_{1}\cdots p_{L}}+O(\tau(p_{1}\cdots p_{L}))$
$\displaystyle=2A\left(\frac{(p_{1}-1)\cdots(p_{L}-1)}{p_{1}\cdots
p_{L}}\right)+O_{L}(1)$ (5.4)

and similarly,

${\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})=2B\left(\frac{(p_{1}-1)\cdots(p_{L}-1)}{p_{1}\cdots
p_{L}}\right)+O_{L}(1).$

Thus,

$\displaystyle R_{1}(P,S,T)$ $\displaystyle=$
$\displaystyle\frac{1}{2^{L}}\prod_{j=1}^{L}\frac{1}{p_{j}-1}\left(\frac{2A(p_{1}-1)\cdots(p_{L}-1)}{p_{1}\cdots
p_{L}}+O_{L}(1)\right)\left(\frac{2B(p_{1}-1)\cdots(p_{L}-1)}{p_{1}\cdots
p_{L}}+O_{L}(1)\right)$ $\displaystyle=$
$\displaystyle\frac{AB}{2^{L-2}p_{1}\cdots
p_{L}}+O_{L}\left(\frac{AB}{p^{L+\frac{1}{2}}}+\frac{A+B+1}{p^{L}}\right).$
(5.5)

Recall from (3.18) that

$\displaystyle\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)=\prod_{i=1}^{L}(p_{i}-1)H(D(p_{i},p_{i+1}))+O\left(p^{\frac{3L-1}{2}}(\log
p)^{L-1}(\log\log p)^{L-1}\right).$ (5.6)

From $\eqref{sjequalsone}$ and $\eqref{dubsumtwo}$ we have that

$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)\left(R_{1}(P,S,T)-\frac{AB}{2^{L-2}p_{1}\cdots
p_{L}}\right)$ $\displaystyle\ll_{L}$
$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\left(\frac{AB}{p^{L+\frac{1}{2}}}+\frac{A+B+1}{p^{L}}\right)\prod_{j=1}^{L}(p_{j}-1)H(D(p_{j},p_{j+1}))$
$\displaystyle\ll_{L}$ $\displaystyle\frac{AB(\log\log X)}{(\log
X)^{L-1}}+\frac{(A+B+1)\sqrt{X}}{(\log X)^{L}},$ (5.7)

by partial summation, Proposition 3.2 and Proposition 3.3. We have that
$\eqref{jonebound}$ is smaller than the first two terms on the RHS in the
error term of $\eqref{lemerrorbound}$. Thus, $\eqref{jonebound}$ is a lower
order error term.

We now consider $R_{2}(P,S,T)$. From $\eqref{achistuff}$ we have that

$\displaystyle R_{2}(P,S,T)$
$\displaystyle=\frac{1}{2^{L}}\sum_{\begin{subarray}{c}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm
s.t.}\>\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}\prod_{j=1}^{L}\frac{\chi_{j}^{\prime}(t_{j})}{(p_{j}-1)}\left(2A\prod_{i=1}^{L}\frac{(p_{i}-1)}{p_{i}}+O_{L}(1)\right){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})$
$\displaystyle\ll_{L}\frac{A}{p_{1}\cdots
p_{L}}\sum_{\begin{subarray}{c}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm
s.t.}\>\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})|.$

Similarly, we have that

$R_{3}(P,S,T)\ll_{L}\frac{B}{p_{1}\cdots
p_{L}}\sum_{\begin{subarray}{c}\chi_{i}^{4}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm s.t.}\>\chi_{j}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}|{\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}})|.$

Thus, we have that

$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)(R_{2}(P,S,T)+R_{3}(P,S,T))$
$\displaystyle\ll_{L}$ $\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\prod_{j=1}^{L}H(D(p_{j},p_{j+1}))\Bigg{(}A\sum_{\begin{subarray}{c}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm
s.t.}\>\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})|$
$\displaystyle+$ $\displaystyle
B\sum_{\begin{subarray}{c}\chi_{i}^{4}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm s.t.}\>\chi_{j}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}|{\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}})|\Bigg{)}.$
(5.8)

Let

$\displaystyle{\underset{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}{{\sum}^{*}}}1=\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\sum_{\begin{subarray}{c}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm
s.t.}\>\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}1,$

then by Holder’s inequality we have that the first sum in
$\eqref{errortermjtwo}$ becomes

$\displaystyle A\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\prod_{j=1}^{L}\frac{H(D(p_{j},p_{j+1}))}{p_{j}}\sum_{\begin{subarray}{c}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm
s.t.}\>\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})|$
$\displaystyle\ll_{L}$ $\displaystyle
A\Bigg{(}\underset{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}{{\sum}^{*}}\prod_{j=1}^{L}\left(\frac{H(D(p_{j},p_{j+1}))}{p_{j}}\right)^{\frac{2k}{2k-1}}\Bigg{)}^{1-\frac{1}{2k}}\Bigg{(}\underset{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}{{\sum}^{*}}|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})|^{2k}\Bigg{)}^{\frac{1}{2k}}.$
(5.9)

Since there are a bounded number of characters in the sums in
$\eqref{sjholder}$ from $\eqref{hdellbound}$ we have that

$\displaystyle\Bigg{(}\underset{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}{{\sum}^{*}}\prod_{j=1}^{L}\left(\frac{H(D(p_{j},p_{j+1}))}{p_{j}}\right)^{\frac{2k}{2k-1}}\Bigg{)}^{1-\frac{1}{2k}}$
$\displaystyle\ll_{L}$ $\displaystyle\Bigg{(}\sum_{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\left(\frac{(\log p)^{L}(\log\log
p)^{L}}{p^{\frac{L}{2}}}\right)^{\frac{2k}{2k-1}}\Bigg{)}^{1-\frac{1}{2k}}\ll_{L}X^{\frac{1}{2}-\frac{L+1}{4k}}(\log
X)^{\frac{L}{2k}}(\log\log X)^{L}.$ (5.10)

Let $J\subseteq\\{1,\ldots,L\\}$ be the set of positive integers such that if
$j\in J$ then $\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{j})$. For $R_{2}(P,S,T)$ we have that
$J\neq\emptyset$. Thus,

$|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})|=\Bigg{|}\sum_{|b|\leq
B}\overline{\chi_{1}^{\prime}}(b)\cdots\overline{\chi_{L}^{\prime}}(b)\Bigg{|}=\Bigg{|}\sum_{|b|\leq
B}\prod_{j\in J}\overline{\chi_{j}^{\prime}}(b)\prod_{j\not\in
J}\overline{\chi_{j}^{\prime}}(b)\Bigg{|}=\Bigg{|}\sum_{\begin{subarray}{c}|b|\leq
B\\\ (b,\prod_{j\not\in J}p_{j})=1\end{subarray}}\prod_{j\in
J}\overline{\chi_{j}^{\prime}}(b)\Bigg{|}.$

Let $\tau_{k}(b;B)$ denote the number of ways of writing $b$ as a product of
$k$ positive integers at most $B$. Then

$\Bigg{|}\sum_{\begin{subarray}{c}|b|\leq B\\\ (b,\prod_{j\not\in
J}p_{j})=1\end{subarray}}\prod_{j\in
J}\overline{\chi_{j}^{\prime}}(b)\Bigg{|}^{2k}\ll_{L}\Bigg{|}\sum_{\begin{subarray}{c}b\leq
B\\\ (b,\prod_{j\not\in J}p_{j})=1\end{subarray}}\prod_{j\in
J}\overline{\chi_{j}^{\prime}}(b)\Bigg{|}^{2k}=\Bigg{|}\sum_{\begin{subarray}{c}b\leq
B^{k}\\\ (b,\prod_{j\not\in J}p_{j})=1\end{subarray}}\tau_{k}(b;B)\prod_{j\in
J}\overline{\chi_{j}^{\prime}}(b)\Bigg{|}^{2}.$

Thus, for the second product in $\eqref{sjholder}$ we have that

$\Bigg{(}\underset{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}{{\sum}^{*}}|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})|^{2k}\Bigg{)}^{\frac{1}{2k}}\ll_{L}\Bigg{(}\underset{\begin{subarray}{c}p\leq
X\\\ p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}{{\sum}^{*}}\Bigg{|}\sum_{\begin{subarray}{c}b\leq B^{k}\\\
(b,\prod_{j\not\in J}p_{j})=1\end{subarray}}\tau_{k}(b;B)\prod_{j\in
J}\overline{\chi_{j}^{\prime}}(b)\Bigg{|}^{2}\Bigg{)}^{\frac{1}{2k}}.$ (5.11)

We have that $\prod_{j\in J}\overline{\chi_{j}^{\prime}}(b)$ is a primitive
character modulo $\prod_{j\in J}p_{j}$. Now we extend the sum in
$\eqref{holdboundtwo}$ to a sum over all primitive characters modulo $d$ for
all modulus $d\leq Q=X^{L}$, since $\prod_{j\in J}p_{j}\ll_{L}X^{L}$. Using
the large sieve inequality, Theorem 2.4, gives

$\displaystyle\Bigg{(}\underset{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}{{\sum}^{*}}\Bigg{|}\sum_{\begin{subarray}{c}b\leq B^{k}\\\
(b,\prod_{j\not\in J}p_{j})=1\end{subarray}}\tau_{k}(b;B)\prod_{j\in
J}\overline{\chi_{j}^{\prime}}(b)\Bigg{|}^{2}\Bigg{)}^{\frac{1}{2k}}$
$\displaystyle\ll_{L}$ $\displaystyle\Bigg{(}\sum_{\begin{subarray}{c}d\leq
X^{L}\\\ \chi\allowbreak\mkern 7.0mu({\operator@font mod}\,\,d)\\\ \chi\>{\rm
primitive}\end{subarray}}\Bigg{|}\sum_{b\leq
B^{k}}\tau_{k}(b;B)\chi(b)\Bigg{|}^{2}\Bigg{)}^{\frac{1}{2k}}\ll_{L}\Bigg{(}\sum_{\begin{subarray}{c}d\leq
X^{L}\\\ \chi\allowbreak\mkern 7.0mu({\operator@font mod}\,\,d)\\\ \chi\>{\rm
primitive}\end{subarray}}\Bigg{|}\sum_{b\leq
B^{k}}\tau_{k}(b)\chi(b)\Bigg{|}^{2}\Bigg{)}^{\frac{1}{2k}}$
$\displaystyle\ll_{L}$ $\displaystyle\Bigg{(}(B^{k}+X^{2L})\sum_{b\leq
B^{k}}\left|\tau_{k}(b)\right|^{2}\Bigg{)}^{\frac{1}{2k}}\ll_{L}\left((B^{k}+X^{2L})B^{k}\log^{k^{2}-1}(B^{k})\right)^{\frac{1}{2k}}.$
(5.12)

Combining $\eqref{sjholder},\eqref{holdboundone}$ and
$\eqref{lalsieveboundprim}$ gives

$\displaystyle A\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\prod_{j=1}^{L}H(D(p_{j},p_{j+1}))\sum_{\begin{subarray}{c}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm
s.t.}\>\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})|$
$\displaystyle\ll_{L}$ $\displaystyle
A\left((B^{k}+X^{2L})B^{k}\log^{k^{2}-1}(B^{k})\right)^{\frac{1}{2k}}X^{\frac{1}{2}-\frac{L+1}{4k}}(\log
X)^{\frac{L}{2k}}(\log\log X)^{L}.$ (5.13)

First suppose that $B^{k}>X^{2L}$. Then we have that the RHS of
$\eqref{lalsieveboundprim}$ becomes

$\displaystyle\left((B^{k}+X^{2L})B^{k}\log^{k^{2}-1}(B^{k})\right)^{\frac{1}{2k}}\ll_{k,L}B\log^{\frac{k^{2}-1}{2k}}B,$
(5.14)

for $k\geq 1$. Now suppose that $B^{k}\leq X^{2L}$ for all $k\geq 1$. Then we
can replace $\log B$ by $\log X$ in $\eqref{lalsieveboundprim}$, which gives

$\displaystyle\left((B^{k}+X^{2L})B^{k}\log^{k^{2}-1}(B^{k})\right)^{\frac{1}{2k}}\ll_{k,L}\sqrt{B}X^{\frac{L}{k}}(\log
X)^{\frac{k^{2}-1}{2k}}.$ (5.15)

Since

$(B^{k}+X^{2L})^{\frac{1}{2k}}\ll_{k,L}\sqrt{B}+X^{\frac{L}{k}},$

combining $\eqref{lholdboundfourprim}$ and $\eqref{lholdboundfiveprim}$ with
$\eqref{lholdboundthreeprim}$ gives

$\displaystyle A\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\prod_{i=1}^{L}H(D(p_{i},p_{i+1}))\sum_{\begin{subarray}{c}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm
s.t.}\>\chi_{j}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})|$
$\displaystyle\ll_{L,k}$ $\displaystyle ABX^{\frac{1}{2}-\frac{L+1}{4k}}(\log
X)^{\frac{L}{2k}}(\log\log
X)^{L}\log^{\frac{k^{2}-1}{2k}}B+A\sqrt{B}X^{\frac{1}{2}+\frac{3L-1}{4k}}(\log
X)^{\frac{k^{2}+L-1}{2k}}(\log\log X)^{L}.$ (5.16)

Similarly we have that

$\displaystyle B\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\prod_{j=1}^{L}H(D(p_{j},p_{j+1}))\sum_{\begin{subarray}{c}\chi_{i}^{4}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq j\leq L\>{\rm s.t.}\>\chi_{j}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font
mod}\,\,p_{j})\end{subarray}}|{\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}})|$
$\displaystyle\ll_{L,k}$ $\displaystyle ABX^{\frac{1}{2}-\frac{L+1}{4k}}(\log
X)^{\frac{L}{2k}}(\log\log
X)^{L}\log^{\frac{k^{2}-1}{2k}}A+B\sqrt{A}X^{\frac{1}{2}+\frac{3L-1}{4k}}(\log
X)^{\frac{k^{2}+L-1}{2k}}(\log\log X)^{L}.$ (5.17)

Thus, from $\eqref{secondtermbound}$ and $\eqref{sjthreebound}$ we have that
$\eqref{errortermjtwo}$ becomes

$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)(R_{2}(P,S,T)+R_{3}(P,S,T))$
$\displaystyle\ll_{k,L}$ $\displaystyle ABX^{\frac{1}{2}-\frac{L+1}{4k}}(\log
X)^{\frac{L}{2k}}(\log\log
X)^{L}(\log^{\frac{k^{2}-1}{2k}}A+\log^{\frac{k^{2}-1}{2k}}B)$
$\displaystyle+$
$\displaystyle(A\sqrt{B}+B\sqrt{A})X^{\frac{1}{2}+\frac{3L-1}{4k}}(\log
X)^{\frac{k^{2}+L-1}{2k}}(\log\log X)^{L}.$ (5.18)

Now consider the final case $R_{4}(P,S,T)$. Let

$W(P,\chi_{i},\chi_{i}^{\prime}):=\sum_{\begin{subarray}{c}1\leq
s_{i},t_{i}<p_{i}\\\ 1\leq i\leq
L\end{subarray}}w(P,S,T)\chi_{i}(s_{i})\chi_{i}^{\prime}(t_{i}).$

Then we have that

$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)R_{4}(P,S,T)$ $\displaystyle=$
$\displaystyle\frac{1}{2^{L}}\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\prod_{j=1}^{L}\frac{1}{p_{j}(p_{j}-1)}\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}W(P,\chi_{i},\chi_{i}^{\prime}){\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}}){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}}).$
(5.19)

We use Hölder’s inequality to obtain

$\displaystyle\Bigg{|}\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}W(P,\chi_{i},\chi_{i}^{\prime}){\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}}){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})\Bigg{|}$
$\displaystyle\leq$
$\displaystyle\Bigg{|}\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}\left|W(P,\chi_{i},\chi_{i}^{\prime})\right|^{2}\Bigg{|}^{\frac{1}{2}}\Bigg{(}\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}\left|{\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}})\right|^{4}\Bigg{)}^{\frac{1}{4}}$
$\displaystyle\times$
$\displaystyle\Bigg{(}\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}\left|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})\right|^{4}\Bigg{)}^{\frac{1}{4}}.$
(5.20)

We can extend the sums in the last two products in $\eqref{jfourcauchy}$ to a
sum over all non-principal characters modulo $p_{1}\cdots p_{L}$. Thus, from
Theorem 2.5 we have that

$\displaystyle\Bigg{(}\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}\left|{\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}})\right|^{4}\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}\left|{\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})\right|^{4}\Bigg{)}^{\frac{1}{4}}$
$\displaystyle\ll_{L}$
$\displaystyle\Bigg{(}\sum_{\chi\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{1}\cdots p_{L})}\Bigg{|}\sum_{|a|\leq
A}\overline{\chi}(a)\Bigg{|}^{4}\Bigg{)}^{\frac{1}{4}}\Bigg{(}\sum_{\chi^{\prime}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{1}\cdots p_{L})}\Bigg{|}\sum_{|b|\leq
B}\overline{\chi^{\prime}}(b)\Bigg{|}^{4}\Bigg{)}^{\frac{1}{4}}$
$\displaystyle\ll_{L}$ $\displaystyle\sqrt{ABp_{1}\cdots p_{L}}(\log
p_{1}\cdots p_{L})^{3}\ll_{L}\sqrt{ABp_{1}\cdots p_{L}}(\log p)^{3}.$ (5.21)

Set $S^{\prime}:=(s_{1}^{\prime},\ldots,s_{L}^{\prime})$ and
$T^{\prime}:=(t_{1}^{\prime},\ldots,t_{L}^{\prime}).$ We then extend the first
sum in $\eqref{jfourcauchy}$ to a sum over all possible products of characters
modulo $p_{1}\cdots p_{L}$ (including the trivial character). Then we use the
bound from $\eqref{dubsumtwo}$ to obtain

$\displaystyle\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}\left|W(P,\chi_{i},\chi_{i}^{\prime})\right|^{2}\leq\sum_{\begin{subarray}{c}\chi_{i},\chi_{i}^{\prime}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ 1\leq i\leq
L\end{subarray}}\left|W(P,\chi_{i},\chi_{i}^{\prime})\right|^{2}$
$\displaystyle\leq\sum_{S,T\in\mathbb{F}(P)^{*}}\sum_{S^{\prime},T^{\prime}\in\mathbb{F}(P)^{*}}w(P,S,T)\overline{w(P,S^{\prime},T^{\prime})}\sum_{\chi_{i}\allowbreak\mkern
7.0mu({\operator@font
mod}\,\,p_{i})}\chi_{i}(s_{i})\overline{\chi_{i}}(s_{i}^{\prime})\sum_{\chi_{i}^{\prime}\allowbreak\mkern
7.0mu({\operator@font
mod}\,\,p_{i})}\chi_{i}^{\prime}(t_{i})\overline{\chi_{i}^{\prime}}(t_{i}^{\prime})$
$\displaystyle=\prod_{i=1}^{L}(p_{i}-1)^{2}\sum_{S,T\in\mathbb{F}(P)^{*}}\left|w(P,S,T)\right|^{2}$
$\displaystyle=p^{3L}\prod_{i=1}^{L}H(D(p_{i},p_{i+1}))+O_{L}\left(p^{\frac{7L-1}{2}}(\log
p)^{L}(\log\log p)^{L}\right),$ (5.22)

since $|w(P,S,T)|^{2}=w(P,S,T)$.

By combining $\eqref{jfourcauchy},\eqref{jfourone}$ and $\eqref{jfourtwo}$ we
have that

$\displaystyle\Bigg{|}\sum_{\begin{subarray}{c}\chi_{i}^{4}(\chi_{i}^{\prime})^{6}=\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{i})\\\ {\rm for}\>1\leq i\leq L\>{\rm and}\\\
\exists 1\leq r,s\leq L\>{\rm s.t.}\>\chi_{r}\neq\chi_{0}\allowbreak\mkern
7.0mu({\operator@font mod}\,\,p_{r}),\\\
\chi_{s}^{\prime}\neq\chi_{0}\allowbreak\mkern 7.0mu({\operator@font
mod}\,\,p_{s})\end{subarray}}W(P,\chi_{i},\chi_{i}^{\prime}){\mathcal{A}}(\overline{\chi_{1}\cdots\chi_{L}}){\mathcal{B}}(\overline{\chi_{1}^{\prime}\cdots\chi_{L}^{\prime}})\Bigg{|}$
$\displaystyle\ll_{L}$ $\displaystyle\sqrt{AB}p^{2L}(\log
p)^{3}\prod_{i=1}^{L}(H(D(p_{i},p_{i+1})))^{2}.$ (5.23)

Then substituting $\eqref{wpfourstuff}$ into $\eqref{sfoursumblah}$ gives

$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)R_{4}(P,S,T)$
$\displaystyle\ll_{L}$ $\displaystyle\sqrt{AB}\sum_{p\leq X}(\log
p)^{3}\sum_{\begin{subarray}{c}p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\prod_{j=1}^{L}\sqrt{H(D(p_{j},p_{j+1}))}.$ (5.24)

To obtain a better error term, instead of using the bound from
$\eqref{hdellbound}$ for $H(D(p_{j},p_{j+1}))$, we use Cauchy-Schwarz,
Proposition 3.2 and Proposition 3.3 to bound the inner sum in
$\eqref{jfourprecauchy}$. This yields

$\displaystyle\sum_{\begin{subarray}{c}p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq
i\leq L-1\end{subarray}}\prod_{j=1}^{L}\sqrt{H(D(p_{j},p_{j+1}))}$
$\displaystyle\ll_{L}$
$\displaystyle\Bigg{(}\prod_{i=1}^{L-2}\frac{\sqrt{p_{i}}}{\log
p_{i}}\sum_{p_{i}^{-}<p_{i+1}<p_{i}^{+}}H(D(p_{i},p_{i+1}))\frac{\sqrt{p}}{\log
p}\sum_{p_{L-1}^{-}<p_{L}<p_{L-1}^{+}}H(D(p_{L-1},p_{L}))H(D(p_{L},p))\Bigg{)}^{\frac{1}{2}}$
$\displaystyle\ll_{L}$ $\displaystyle\prod_{i=1}^{L-2}\left(\frac{p_{i}}{\log
p_{i}}\cdot\frac{\sqrt{p_{i}}}{\log
p_{i}}\right)^{\frac{1}{2}}\left(\frac{\sqrt{p}}{\log
p}\cdot\frac{p^{\frac{3}{2}}}{\log
p}\right)^{\frac{1}{2}}\ll_{L}\frac{p^{\frac{3L-2}{4}}}{(\log p)^{L-1}}.$
(5.25)

From $\eqref{jfourprecauchy}$ and $\eqref{cauchyhbound}$ we have that

$\displaystyle\sum_{\begin{subarray}{c}p\leq X\\\
p_{i}^{-}<p_{i+1}<p_{i}^{+}\\\ 1\leq i\leq
L-1\end{subarray}}\frac{1}{p_{1}\cdots
p_{L}}\sum_{S,T\in\mathbb{F}(P)^{*}}w(P,S,T)R_{4}(P,S,T)\ll_{L}\sqrt{AB}X^{\frac{3L+2}{4}}(\log
X)^{3-L}.$ (5.26)

Combining $\eqref{jtwosevenbound}$ and $\eqref{jeightbound}$ gives the result.
∎

## References

  * [Bai] S. Baier,  A remark on the Lang-Trotter conjecture. New directions in value-distribution theory of zeta and $L$-functions.  Ber. Math., Shaker Verlag, Aachen (2009), 11–18.
  * [BCD] A. Balog, A. Cojocaru, and C. David.  Average twin prime conjecture for elliptic curves.  Amer. J. Math. 133 (2011), no. 5, 1179–1229.
  * [BaSh] W. Banks and I. Shparlinski,  Sato-Tate, cyclicity, and divisibility statistics on average for elliptic curves of small height.  Israel J. Math. 173 (2009), 253–277.
  * [CDKS] V. Chandee, C. David, D. Koukoulopoulos and E. Smith,  Elliptic curves over finite fields with a given group structure.  In preparation.
  * [Dav] H. Davenport,  Multiplicative Number Theory. Third edition. Revised and with a preface by Hugh L. Montgomery. Graduate Texts in Mathematics, 74  Springer-Verlag, New York, 2000.
  * [DaPa] C. David and F. Pappalardi,  Average Frobenius distributions of elliptic curves.  Internat. Math. Res. Notices 1999, no. 4, 165–183.
  * [Deu] M. Deuring,  Die Typen der Multiplikatorenringe elliptischer Funktionenkörper.  Abh. Math. Sem. Univ. Hamburg, 14 (1941), no. 1, 197–272.
  * [Elk] N. Elkies,  The existence of infinitely many supersingular primes for every elliptic curve over $\mathbb{Q}$.  Invent. Math. 89 (1987), no. 3, 561–567.
  * [Ell] P. Elliott,  On the size of $L(1,\chi)$,  J. reine angew. Math. 236 (1969), 26–36.
  * [FoMu] E. Fouvry and M. R. Murty,  On the distribution of supersingular primes.  Canad. J. Math. 48 (1996), no. 1, 81–104.
  * [FrIw1] J. Friedlander and H. Iwaniec,  On Bombieri’s asymptotic sieve.  Ann. Scuola Norm. Sup. Pisa Cl. Sci. (4) 5 (1978), no. 4, 719–756.
  * [FrIw2] J. Friedlander and H. Iwaniec,  The divisor problem for arithmetic progressions.  Acta Arith. 45 (1985), 273–277.
  * [GrSo] A. Granville and K. Soundararajan,  The distribution of values of $L(1,\chi_{d})$.  Geom. Funct. Anal., 13 (2003), no. 5, 992–1028.
  * [HaRi] H. Halberstam and H.-E. Richert,  Sieve methods,  London Mathematical Society Monographs, No. 4. Academic Press, London-New York, 1974.
  * [HSBT] M. Harris, N. Shepherd-Barron and R. Taylor,  A family of Calabi-Yau varieties and potential automorphy.  Ann. of Math. (2) 171 (2010), no. 2, 779–813.
  * [IwKo] H. Iwaniec and E. Kowalski,  Analytic number theory,  American Mathematical Society Colloquim Publications, vol. 53, 2004.
  * [Jon] N. Jones,  Elliptic aliquot cycles of fixed length.  Pacific J. Math. 263 (2013), no. 2, 353–371.
  * [Kob] N. Koblitz,  Primality of the number of points on an elliptic curve over a finite field.  Pacific J. Math. 131 (1998), no. 1, 157–165.
  * [LaTr] S. Lang and H. Trotter,  Frobenius distributions in $GL_{2}$-extensions. Lecture Notes in Mathemtics, Vol. 504.  Springer-Verlag, Berlin-New York, 1976. Distribution of Frobenius automorphismsin $GL_{2}$-extensions of the rational numbers.
  * [Len] H. Lenstra,  Factoring integers with elliptic curves.  Ann. of Math. (2) 126 (1987), no. 3, 649–673.
  * [Maz] B. Mazur,  Rational points of abelian varieties with values in towers of number fields.  Invent. Math. 18 (1972), 183–266.
  * [MuMu] M. Ram Murty and V. Kumar Murty,  The Sato-Tate conjecture and generalizations.  Math. Newsl. 19 (2010), Sp. Number 1, 247–257.
  * [Pa] J. Parks,  The average number of amicable pairs.  In preparation.
  * [Ser] J-P. Serre,  Propriétés galoisiennes des points d’ordre fini des courbes elliptiques,  Invent. Math. 15 (1972), 259–331.
  * [Sil] J. Silverman,  The arithmetic of elliptic curves, Graduate Texts in Mathematics, 106  Springer-Verlag, New York, 1986.
  * [SiSt] J. Silverman and K. Stange,  Amicable pairs and aliquot cycles for elliptic curves.  Exp. Math. 20 (2011), no. 3, 329–357.
  * [Smy] C. Smyth,  The terms in Lucas sequences divisible by their indices.  J. Integer Seq. 13 (2010), no. 2, Article 10.2.4, 18 pp.
  * [Ste] S. Stepanov,  Arithmetic of Algebraic Curves. Translated from the Russian by Irene Aleksanova. Monographs in Contemporary Mathematics.  Consultants Bureau, New York, 1994.
  * [Zyw] D. Zywina,  A refinement of Koblitz’s conjecture.  Int. J. Number Theory 7 (2011), no. 3, 739–769.