*3.4. Asymptotic Difference*

We begin this section by the following lemmas on the autocorrelation polynomials.

**Lemma 8** (Jacquet and Szpankowski, 1994)**.** *For most words w, the autocorrelation polynomial Sw*(*z*) *is very close to 1, with high probably. More precisely, if w is a binary word of length k and δ* = √*p, there exists ρ* > 1*, such that ρδ* < 1 *and*

$$\sum\_{w \in \mathcal{A}^k} \left[ |S\_w(\rho) - 1| \le (\rho \delta)^k \theta \right] \mathbf{P}(w) \ge 1 - \theta \delta^k,\tag{48}$$

*where θ* = (1 − *<sup>p</sup>*)−1*. We use Iverson notation*

$$\begin{aligned} [A] = \begin{cases} 1 & \text{if } A \text{ holds} \\ 0 & \text{otherwise} \end{cases} \end{aligned} $$

**Lemma 9** (Jacquet and Szpankowski, 1994)**.** *There exist K* > 0 *and ρ* > 1*, such that pρ* < 1*, and for every binary word w with length k* ≥ *K and* |*z*| ≤ *ρ, we have*

$$|S\_w(z)| \, > \, 0. \tag{49}$$

*In other words, Sw*(*z*) *does not have any roots in* |*z*| ≤ *ρ.*

**Lemma 10.** *With high probability, for most distinct pairs* {*<sup>w</sup>*, *<sup>w</sup>*}*, the correlation polynomial Sw*,*w*(*z*) *is very close to 0. More precisely, if w and w are two distinct binary words of length k and δ* = √*p, there exists ρ* > 1*, such that ρδ* < 1 *and*

$$\sum\_{w \in \mathcal{A}^k} \| |S\_{w, w'}(\rho)| \le (\rho \delta)^k \theta \| \mathbf{P}(w) \ge 1 - \theta \delta^k \tag{50}$$

We will use the above results to prove that the expected values in the Bernoulli model and the model built over a trie are asymptotically equivalent. We now prove Theorem 1 below.

**Proof of Theorem 1.** From Lemmas 3 and 4, we have

$$H(z) = \sum\_{w \in \mathcal{A}^k} \left( \frac{1}{1 - z} - \frac{S\_w(z)}{D\_w(z)} \right) \cdot \frac{1}{z}$$

and

$$\hat{H}(z) = \sum\_{w \in \mathcal{A}^k} \left( \frac{1}{1 - z} - \frac{1}{1 - (1 - \mathbb{P}(w))z} \right) \dots$$

subtracting the two generating functions, we obtain

$$H(z) - \hat{H}(z) = \sum\_{w \in \mathcal{A}^k} \left( \frac{1}{1 - (1 - \mathbf{P}(w))z} - \frac{S\_w(z)}{D\_w(z)} \right). \tag{51}$$

> We define

$$\Delta\_w(z) = \frac{1}{1 - (1 - \mathbb{P}(w))z} - \frac{\mathbb{S}\_w(z)}{D\_w(z)}.\tag{52}$$

Therefore, by Cauchy integral formula (see [20]), we have

$$[z^{\eta}]\Lambda\_{\Psi}(z) = \frac{1}{2\pi i}\oint \Lambda\_{\Psi}(z)\frac{dz}{z^{n+1}} = \text{Res}\_{z=0} \Lambda\_{\Psi}(z)\frac{dz}{z^{n+1}}\tag{53}$$

where the path of integration is a circle about zero with counterclockwise orientation. We note that the above integrand has poles at *z* = 0, *z* = 1 1 − **<sup>P</sup>**(*w*), and *z* = *Aw* (refer to expression (29)). Therefore, we define

$$I^w(\rho) := \frac{1}{2\pi i} \int\_{|z|=\rho} \Lambda\_w(z) \frac{dz}{z^{n+1}} \,. \tag{54}$$

where the circle of radius *ρ* contains all of the above poles. By the residue theorem, we have

$$I^w(\rho) = \text{Res}\_{z=0} \frac{\Lambda\_{\overline{w}}(z)}{z^{n+1}} + \text{Res}\_{z=A\_{\overline{w}}} \frac{\Lambda\_{\overline{w}}(z)}{z^{n+1}} + \text{Res}\_{z=1/1 - \mathbb{P}(w)} \frac{\Lambda\_{\overline{w}}(z)}{z^{n+1}}$$

$$= [z^n] \Lambda\_{\overline{w}}(z) - \text{Res}\_{z=A\_{\overline{w}}} \frac{H\_{\overline{w}}(z)}{z^{n+1}} + \text{Res}\_{z=1/1 - \mathbb{P}(w)} \frac{\hat{H}\_{\overline{w}}(z)}{z^{n+1}}\tag{55}$$

We observe that

$$\operatorname{Res}\_{z=A\_{\text{uv}}} \frac{\Delta\_{\text{uv}}(z)}{z^{n+1}} = \frac{S\_{\text{uv}}(A\_{\text{uv}})}{B\_{\text{uv}} A\_{\text{uv}}^{n+1}}, \quad \text{where } B\_{\text{uv}} \text{ is as in (30)}$$

$$\operatorname{Res}\_{z=1/1-\mathbf{P}(\text{uv})} \frac{\hat{H}\_{\text{uv}}(z)}{z^{n+1}} = -(1-\mathbf{P}(w))^{n+1}.$$

Then we obtain

$$[z^{\boldsymbol{w}}]\Lambda\_{\boldsymbol{w}} = l^{\boldsymbol{w}}(\boldsymbol{\rho}) - \frac{S\_{\boldsymbol{w}}(A\_{\boldsymbol{w}})}{B\_{\boldsymbol{w}}A\_{\boldsymbol{w}}^{\boldsymbol{w}+1}} - (1 - \mathbf{P}(\boldsymbol{w}))^{\boldsymbol{w}+1},\tag{56}$$

and finally, we have

$$\begin{split} [z^{n}](H(z) - \hat{H}(z)) &= \sum\_{w \in \mathcal{A}^{k}} [z^{n}] \Delta\_{w} \\ &= \sum\_{w \in \mathcal{A}^{k}} I\_{n}^{w}(\rho) - \sum\_{w \in \mathcal{A}^{k}} \left( \frac{S\_{w}(A\_{w})}{B\_{w} A\_{w}^{n+1}} + (1 - \mathbf{P}(w))^{n+1} \right) . \end{split} \tag{57}$$

First, we show that, for sufficiently large *n*, the sum ∑*w*∈A*<sup>k</sup>* - *Sw*(*Aw*) *Bw An*<sup>+</sup><sup>1</sup> *w* + (1 − **<sup>P</sup>**(*w*))*n*+<sup>1</sup> approaches zero.

**Lemma 11.** *For large enough n, and for k* = Θ(log *<sup>n</sup>*)*, there exists M* > 0 *such that*

$$\sum\_{w \in \mathcal{A}^k} \left( \frac{S\_w(A\_w)}{B\_w A\_w^{n+1}} + (1 - \mathbf{P}(w))^{n+1} \right) = O(n^{-M}).\tag{58}$$

**Proof.** We let

$$r\_{\mathcal{U}}(z) = (1 - \mathbf{P}(w))^z + \frac{S\_{\mathcal{U}}(A\_w)}{B\_{\mathcal{U}} A\_w^z}. \tag{59}$$

The Mellin transform of the above function is

$$r\_w^\*(s) = \Gamma(s) \log^{-s} \left( \frac{1}{1 - \mathbf{P}(w)} \right) - \frac{S\_w(A\_w)}{B\_w} \Gamma(s) \log^{-s} (A\_w). \tag{60}$$

We define

$$\mathcal{C}\_{w} = \frac{S\_{w}(A\_{w})}{B\_{w}} = \frac{S\_{w}(A\_{w})}{-S\_{w}(1) + O(k\mathbf{P}(w))},\tag{61}$$

which is negative and uniformly bounded for all *w*. Also, for a fixed *s*, we have

$$\begin{split} \ln^{-s} \left( \frac{1}{1 - \mathsf{P}(w)} \right) &= \ln^{-s} \left( 1 + \mathsf{P}(w) + O \left( \mathsf{P}(w)^2 \right) \right) \\ &= \left( \mathsf{P}(w) + O \left( \mathsf{P}(w)^2 \right) \right)^{-s} \\ &= \mathsf{P}(w)^{-s} \left( 1 + O \left( \mathsf{P}(w) \right) \right)^{-s} \\ &= \mathsf{P}(w)^{-s} \left( 1 + O \left( \mathsf{P}(w) \right) \right), \end{split} \tag{62}$$

$$\begin{split} \ln^{-s}(A\_{\mathrm{w}}) &= \ln^{-s}\left(1 - \left(-\frac{\mathbf{P}(w)}{S\_{\mathrm{w}}(1)} + O\left(\mathbf{P}(w)^{2}\right)\right)\right) \\ &= \left(\frac{\mathbf{P}(w)}{S\_{\mathrm{w}}(1)} + O\left(\mathbf{P}(w)^{2}\right)\right)^{-s} \\ &= \left(\frac{\mathbf{P}(w)}{S\_{\mathrm{w}}(1)}\right)^{-s} (1 + O\left(\mathbf{P}(w)\right))^{-s} \\ &= \left(\frac{\mathbf{P}(w)}{S\_{\mathrm{w}}(1)}\right)^{-s} (1 + O\left(\mathbf{P}(w)\right)), \end{split} \tag{63}$$

and therefore, we obtain

$$r\_w^\*(s) = \Gamma(s)\mathbf{P}(w)^{-s} \left(1 - \frac{1}{S\_w(1)^{-s}}\right) O(1). \tag{64}$$

From this expression, and noticing that the function has a removable singularity at *s* = 0, we can see that the Mellin transform *<sup>r</sup>*<sup>∗</sup>*w*(*s*) exists on the strip where (*s*) > −1. We still need to investigate the Mellin strip for the sum ∑*w*∈A*<sup>k</sup> <sup>r</sup>*<sup>∗</sup>*w*(*s*). In other words, we need to examine whether summing *<sup>r</sup>*<sup>∗</sup>*w*(*s*) over all words of length *k* (where *k* grows with *n*) has any effect on the analyticity of the function. We observe that

$$\begin{split} \sum\_{w \in \mathcal{A}^k} |r\_w^\*(s)| &= \sum\_{w \in \mathcal{A}^k} |\Gamma(s)\mathbb{P}(w)^{-s} \left(1 - \frac{1}{S\_w(1)^{-s}}\right) O(1)| \\ &\leq |\Gamma(s)| \sum\_{w \in \mathcal{A}^k} \mathbb{P}(w)^{-\mathfrak{R}(s)} \left(1 - \frac{1}{S\_w(1)^{-\mathfrak{R}(s)}}\right) O(1) \\ &= (q^k)^{-\mathfrak{R}(s)-1} |\Gamma(s)| \sum\_{w \in \mathcal{A}^k} \mathbb{P}(w) (1 - S\_w(1)^{\mathfrak{R}(s)}) O(1). \end{split}$$

Lemma 8 allows us to split the above sum between the words for which *Sw*(1) ≤ 1 + *O*(*δ<sup>k</sup>*) and words that have *Sw*(1) > 1 + *<sup>O</sup>*(*δ<sup>k</sup>*).

Such a split yields the following

$$\sum\_{w \in \mathcal{A}^k} |r^\*\_w(s)| = (q^k)^{-\Re(s)-1} |\Gamma(s)| \mathcal{O}(\delta^k). \tag{65}$$

This shows that ∑*w*∈A*<sup>k</sup> <sup>r</sup>*<sup>∗</sup>*w*(*s*) is bounded above for (*s*) > −1 and, therefore, it is analytic. This argumen<sup>t</sup> holds for *k* = Θ(log *n*) as well, as (*q<sup>k</sup>*)−(*s*)−<sup>1</sup> would still be bounded above by a constant *Ms*,*<sup>k</sup>* that depends on *s* and *k*.

We would like to approximate ∑*w*∈A*<sup>k</sup> <sup>r</sup>*<sup>∗</sup>*w*(*s*) when *z* → ∞. By the inverse Mellin transform, we have

$$\sum\_{w \in \mathcal{A}^k} r\_w(z) = \frac{1}{2\pi i} \int\_{c-i\infty}^{c+i\infty} \left( \sum\_{w \in \mathcal{A}^k} r\_w^\*(s) \right) z^{-s} ds. \tag{66}$$

We choose *c* ∈ (−1, *M*) for a fixed *M* > 0. Then by the direct mapping theorem [22], we obtain

$$\sum\_{w \in \mathcal{A}^k} r\_w(z) = O(z^{-M}).\tag{67}$$

and subsequently, we ge<sup>t</sup>

$$\sum\_{w \in \mathcal{A}^k} \left( \frac{\mathbb{S}\_w(A\_w)}{B\_{\text{w}} A\_w^{n+1}} + (1 - \mathbb{P}(w))^{n+1} \right) = O(n^{-M}).\tag{68}$$

We next prove the asymptotic smallness of *Iwn* (*ρ*) in (54).

**Lemma 12.** *Let*

$$I\_n^w(\rho) = \frac{1}{2\pi i} \int\_{|z|=\rho} \left( \frac{1}{1 - (1 - \mathbf{P}(w))z} - \frac{S\_w(z)}{D\_w(z)} \right) \frac{dz}{z^{n+1}}.\tag{69}$$

*For large n and k* = Θ(log *<sup>n</sup>*)*, we have*

$$\sum\_{\nu:\nu\in\mathcal{A}^k} I\_n^{w}(\rho) = O\left(\rho^{-n} (\rho\delta)^k\right). \tag{70}$$

**Proof.** We observe that

$$|I\_n^w(\rho)| \le \frac{1}{2\pi} \int\_{|z|=\rho} \left| \frac{\mathbf{P}(w)z\left(z^{k-1} - S\_w(z)\right)}{D\_w(z)\left(1 - (1 - \mathbf{P}(w))z\right)} \frac{1}{z^{n+1}} \right| dz. \tag{71}$$

For |*z*| = *ρ*, we show that the denominator in (71) is bounded away from zero.

$$\begin{aligned} |D\_w(z)| &= |(1-z)S\_w(z) + \mathbf{P}(w)z^k| \\ &\ge |1-z||S\_w(z)| - \mathbf{P}(w)|z^k| \\ &\ge (\rho - 1)a - (p\rho)^k, \quad \text{where } a > 0 \text{ by Lemma 9 } \text{ .} \\ &> 0, \qquad \text{we assume } k \text{ to be large enough such that } (p\rho)^k < a(\rho - 1). \end{aligned}$$

To find a lower bound for |1 − (1 − **<sup>P</sup>**(*w*))*z*|, we can choose *Kw* large enough such that

$$\begin{aligned} |1 - (1 - \mathbf{P}(w))z| &\geq |1 - (1 - \mathbf{P}(w))|z| |\\ &\geq |1 - \rho(1 - p^{K\_w})| \\ &> 0. \end{aligned} \tag{73}$$

We now move on to finding an upper bound for the numerator in (71), for |*z*| = *ρ*.

$$|z^{k-1} - S\_w(z)| \le |S\_w(z) - 1| + |1 - z^{k-1}|$$

$$\begin{split} & \quad \le (S\_w(\rho) - 1) + (1 + \rho^{k-1}) \\ &= (S\_w(\rho) - 1) + O(\rho^k). \end{split} \tag{74}$$

Therefore, there exists a constant *μ* > 0 such that

$$|I\_{\boldsymbol{\eta}}^{\boldsymbol{w}}| \le \mu \rho \mathbf{P}(\boldsymbol{w}) \left( (\mathbb{S}\_{\boldsymbol{w}}(\rho) - 1) + O(\rho^k) \right) \frac{1}{\rho^{\boldsymbol{w} + 1}}$$

$$= O(\rho^{-\eta}) \left( \mathbf{P}(\boldsymbol{w}) (\mathbb{S}\_{\boldsymbol{w}}(\rho) - 1) + \mathbf{P}(\boldsymbol{w}) O(\rho^k) \right). \tag{75}$$

Summing over all patterns *w*, and applying Lemma 8, we obtain

$$\begin{split} \sum\_{w \in \mathcal{A}^{k}} |l\_{n}^{w}(\rho)| &= O(\rho^{-n}) \sum\_{w \in \mathcal{A}^{k}} \mathbf{P}(w) (\mathbb{S}\_{w}(\rho) - 1) + O(\rho^{-n+k}) \sum\_{w \in \mathcal{A}^{k}} \mathbf{P}(w) \\ &= O(\rho^{-n}) \left( \theta(\rho \delta)^{k} + \frac{p\rho}{1 - p\rho} \theta \delta^{k} \right) + O(\rho^{-n+k}) \\ &= O(\rho^{-n} (\rho \delta)^{k}), \end{split} \tag{76}$$

which approaches zero as *n* → ∞ and *k* = Θ(log *<sup>n</sup>*). This completes the proof of of Theorem 1.

Similar to Theorem 1, we provide a proof to show that the second factorial moments of the *k*th Subword Complexity and the *k*th Prefix Complexity, have the same first order asymptotic behavior. We are now ready to state the proof of Theorem 2.

**Proof of Theorem 2.** As discussed in Lemmas 3 and 4, the generating functions representing **<sup>E</sup>**[(*Xn*,*<sup>k</sup>*)2] and **E**[(*X*<sup>ˆ</sup> *<sup>n</sup>*,*<sup>k</sup>*)2] respectively, are

$$G(z) = \sum\_{\substack{w, w' \in \mathcal{A}^k \\ w \neq w'}} \left( \frac{1}{1 - z} - \frac{S\_w(z)}{D\_w(z)} - \frac{S\_{w'}(z)}{D\_{w'}(z)} + \frac{S\_w(z)S\_{w'}(z) - S\_{w, w'}(z)S\_{w', w}(z)}{D\_{w, w'}(z)} \right),$$

and

$$
\hat{G}(z) = \sum\_{\substack{w, w' \in \mathcal{A}^k \\ w \neq w'}} \left( \frac{1}{1 - z} - \frac{1}{1 - (1 - \mathbf{P}(w))z} - \frac{1}{1 - (1 - \mathbf{P}(w'))z} \right)
$$

$$
+ \sum\_{\substack{w, w' \in \mathcal{A}^k \\ w \neq w'}} \frac{1}{1 - (1 - \mathbf{P}(w) - \mathbf{P}(w'))z}.
$$

Note that

$$G(z) - \hat{G}(z) = \sum\_{\substack{w' \in \mathcal{A}^k \\ w \neq w'}} \sum\_{w \in \mathcal{A}^k} \left( \frac{1}{1 - (1 - \mathbb{P}(w))z} - \frac{S\_w(z)}{D\_w(z)} \right) \tag{77}$$

$$+\sum\_{\substack{w\in\mathcal{A}^k\\w\neq w'}}\sum\_{\substack{w'\in\mathcal{A}^k\\w'\neq w'}}\left(\frac{1}{1-(1-\mathbf{P}(w'))z}-\frac{S\_{w'}(z)}{D\_{w'}(z)}\right)\tag{78}$$

$$+\sum\_{\substack{\boldsymbol{w},\boldsymbol{w}'\in\mathcal{A}^{k}\\ \boldsymbol{w}\neq\boldsymbol{w}'}} \left(\frac{1}{1-(1-\mathsf{P}(\boldsymbol{w})-\mathsf{P}(\boldsymbol{w}'))z} - \frac{S\_{\boldsymbol{w}}(\boldsymbol{z})S\_{\boldsymbol{w}'}(\boldsymbol{z}) - S\_{\boldsymbol{w},\boldsymbol{w}'}(\boldsymbol{z})S\_{\boldsymbol{w}',\boldsymbol{w}}(\boldsymbol{z})}{D\_{\boldsymbol{w},\boldsymbol{w}'}(\boldsymbol{z})}\right) \tag{79}$$

In Theorem 1, we proved that for every *M* > 0 (which does not depend on *n* or *k*), we have

$$H(z) - \hat{H}(z) = \sum\_{w \in \mathcal{A}^k} \left( \frac{1}{1 - (1 - \mathbf{P}(w))z} - \frac{S\_{\text{uv}}(z)}{D\_{\text{uv}}(z)} \right) = O(n^{-M}).$$

Therefore, both (77) and (78) are of order (2*k* − <sup>1</sup>)*O*(*n*<sup>−</sup>*<sup>M</sup>*) = *<sup>O</sup>*(*n*<sup>−</sup>*M*+*<sup>a</sup>* log 2) for *k* = *a* log *n*. Thus, to show the asymptotic smallness, it is enough to choose *M* = *a* log 2 + , where  is a small positive value. Now, it only remains to show (79) is asymptotically negligible as well. We define

$$\Delta\_{w,w'}(z) = \frac{1}{1 - (1 - \mathbf{P}(w) - \mathbf{P}(w'))z} - \frac{S\_w(z)S\_{w'}(z) - S\_{w,w'}(z)S\_{w',w}(z)}{D\_{w,w'}(z)}.\tag{80}$$

Next, we extract the coefficient of *z<sup>n</sup>*

$$
\langle z^n \vert \Lambda\_{w, w'}(z) = \frac{1}{2\pi i} \oint \Lambda\_{w, w'}(z) \frac{dz}{z^{n+1}},\tag{81}
$$

where the path of integration is a circle about the origin with counterclockwise orientation. We define

$$I\_n^{w, w'}(\rho) = \frac{1}{2\pi i} \int\_{|z|=\rho} \Delta\_{w, w'}(z) \frac{dz}{z^{n+1}},\tag{82}$$

The above integrand has poles at *z* = 0, *z* = *<sup>α</sup>w*,*w* (as in (46)), and *z* = 1 <sup>1</sup>−**<sup>P</sup>**(*w*)−**<sup>P</sup>**(*w*). We have chosen *ρ* such that the poles are all inside the circle |*z*| = *ρ*. It follows that

$$I\_{n}^{w,w'}(\rho) = \text{Res}\_{z=0} \frac{\Delta\_{w,w'}(z)}{z^{n+1}} + \text{Res}\_{z=a\_{w,w'}} \frac{\Delta\_{w,w'}(z)}{z^{n+1}} + \text{Res}\_{z=\frac{1}{1-\mathbb{P}(w)-\mathbb{P}(w')}} \frac{\Delta\_{w}(z)}{z^{n+1}},\tag{83}$$

and the residues give us the following.

$$\operatorname{Res}\_{z=\frac{1}{1-\mathbf{P}(w)-\mathbf{P}(w')}} \frac{1}{1-(1-\mathbf{P}(w)-\mathbf{P}(w'))z)z^{n+1}} = -(1-\mathbf{P}(w)-\mathbf{P}(w'))^{n+1},$$

and

$$\begin{split} \text{Res}\_{z=a\_{w,\nu'}} \frac{\mathcal{S}\_{w}(z)\mathcal{S}\_{w'}(z) - \mathcal{S}\_{w,\nu\nu'}(z)\mathcal{S}\_{w',\nu}(z)}{D\_{w,\nu\nu'}(z)} &= \\ \frac{\mathcal{S}\_{w}(a\_{w,\nu\nu'})\mathcal{S}\_{w'}(a\_{w,\nu\nu'}) - \mathcal{S}\_{w,\nu\nu'}(a\_{w,\nu\nu'})\mathcal{S}\_{w',\nu}(a\_{w,\nu\nu'})}{\beta\_{w,\nu\nu'}a\_{w,\nu\nu'}^{n+1}} \end{split}$$

where *β<sup>w</sup>*,*w* is as in (47). Therefore, we ge<sup>t</sup>

$$\begin{split} \sum\_{\substack{\boldsymbol{w},\boldsymbol{w}' \in \mathcal{A}^{k} \\ \boldsymbol{w} \neq \boldsymbol{w}'}} \left[ \boldsymbol{z}^{\boldsymbol{w}} \right] \boldsymbol{\Lambda}\_{\boldsymbol{w},\boldsymbol{w}'} (\boldsymbol{z}) &= \sum\_{\substack{\boldsymbol{w},\boldsymbol{w}' \in \mathcal{A}^{k} \\ \boldsymbol{w} \neq \boldsymbol{w}'}} I^{\boldsymbol{w},\boldsymbol{w}'}\_{\boldsymbol{w}} (\boldsymbol{\rho}) \\ &- \sum\_{\substack{\boldsymbol{w},\boldsymbol{w}' \in \mathcal{A}^{k} \\ \boldsymbol{w} \neq \boldsymbol{w}'}} \left( \frac{\boldsymbol{S}\_{\boldsymbol{w}} (\boldsymbol{a}\_{\boldsymbol{w},\boldsymbol{w}'}) \boldsymbol{S}\_{\boldsymbol{w}'} (\boldsymbol{a}\_{\boldsymbol{w},\boldsymbol{w}'}) - \boldsymbol{S}\_{\boldsymbol{w},\boldsymbol{w}'} (\boldsymbol{a}\_{\boldsymbol{w},\boldsymbol{w}'}) \boldsymbol{S}\_{\boldsymbol{w}',\boldsymbol{w}} (\boldsymbol{a}\_{\boldsymbol{w},\boldsymbol{w}'})}{\beta\_{\boldsymbol{w},\boldsymbol{w}'} a\_{\boldsymbol{w},\boldsymbol{w}'}^{n+1}} \right) \\ &+ \left( 1 - \mathsf{P}(\boldsymbol{w}) - \mathsf{P}(\boldsymbol{w}') \right)^{n+1} \Big). \end{split} \tag{84}$$

We now show that the above two terms are asymptotically small. **Lemma 13.** *There exists*  > 0 *where the sum*

$$\sum\_{\substack{w,w' \in \mathcal{A}^k \\ w \neq w'}} \left( \frac{S\_{w}(\boldsymbol{a}\_{w,\boldsymbol{w}'})S\_{w'}(\boldsymbol{a}\_{w,\boldsymbol{w}'}) - S\_{w,\boldsymbol{w}'}(\boldsymbol{a}\_{w,\boldsymbol{w}'})S\_{w',\boldsymbol{w}}(\boldsymbol{a}\_{w,\boldsymbol{w}'})}{\beta\_{w,\boldsymbol{w}'}a\_{w,\boldsymbol{w}'}^{n+1}} + (1 - \mathbb{P}(w) - \mathbb{P}(w'))^{n+1} \right)$$

*is of order O(n*− *).*

**Proof.** We define

$$r\_{w, \mathbf{z}'}(z) = \frac{\mathcal{S}\_{\mathbf{w}}(a\_{w, \mathbf{w}'})\mathcal{S}\_{\mathbf{w}'}(a\_{w, \mathbf{w}'}) - \mathcal{S}\_{w, \mathbf{w}'}(a\_{w, \mathbf{w}'})\mathcal{S}\_{\mathbf{w}', \mathbf{w}}(a\_{w, \mathbf{w}'})}{\beta\_{w, \mathbf{w}'} a\_{w, \mathbf{w}'}^z} + (1 - \mathbf{P}(w) - \mathbf{P}(w'))^z.$$

The Mellin transform of the above function is

$$\sigma\_{w,w'}^\*(s) = \Gamma(s) \log^{-s} \left( \frac{1}{1 - \mathbf{P}(w) - \mathbf{p}(w')} \right) + \mathbb{C}\_{w,w'} \Gamma(s) \log^{-s} (\alpha\_{w,w'}),\tag{85}$$

where *Cw*,*w* = *Sw*(*<sup>α</sup>w*,*w*)*Sw*(*<sup>α</sup>w*,*w*) − *Sw*,*w*(*<sup>α</sup>w*,*w*)*Sw*,*<sup>w</sup>*(*<sup>α</sup>w*,*w*) *β<sup>w</sup>*,*w* . We note that *Cw*,*w* is negative and uniformly bounded from above for all *w*, *w* ∈ A*k*.For a fixes *s*, we also have,

$$\begin{split} \ln^{-s} \left( \frac{1}{1 - \mathsf{P}(w) - \mathsf{P}(w')} \right) &= \ln^{-s} \left( 1 + \mathsf{P}(w) + \mathsf{P}(w') + O \left( p^{2k} \right) \right) \\ &= \left( \mathsf{P}(w) + \mathsf{P}(w') + O \left( p^{2k} \right) \right)^{-s} \\ &= (\mathsf{P}(w) + \mathsf{P}(w'))^{-s} \left( 1 + O \left( p^k \right) \right)^{-s} \\ &= (\mathsf{P}(w) + \mathsf{P}(w'))^{-s} \left( 1 + O \left( p^k \right) \right), \end{split} \tag{86}$$

and

$$\begin{split} \ln^{-s}(a\_{w,w'}) &= \left(\frac{S\_{w'}(1) - S\_{w,w'}(1)}{S\_{w}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w}(1)}\mathbf{P}(w) \\ &\quad + \frac{S\_{w}(1) - S\_{w',w}(1)}{S\_{w}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w}(1)}\mathbf{P}(w') + O(p^{2k})\right)^{-s} \\ &= \left(\frac{S\_{w'}(1) - S\_{w,w'}(1)}{S\_{w}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w}(1)}\mathbf{P}(w) \\ &\quad + \frac{S\_{w}(1) - S\_{w',w}(1)}{S\_{w}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w}(1)}\mathbf{P}(w')\right)^{-s} \left(1 + O(p^k)\right). \end{split} \tag{87}$$

Therefore, we have

$$\begin{split} r^\*\_{w,w'}(s) &= \Gamma(s) \left(\mathbb{P}(w) + \mathbb{P}(w')\right)^{-s} (1 + O(p^k)) \\ &- \Gamma(s) \left(\frac{S\_{w'}(1) - S\_{w,w'}(1)}{S\_{w}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w}(1)} \mathbb{P}(w) \\ &+ \frac{S\_{w}(1) - S\_{w',w}(1)}{S\_{w}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w}(1)} \mathbb{P}(w')\right)^{-s} \left(1 + O(p^k)\right) O(1). \end{split}$$

To find the Mellin strip for the sum ∑*w*∈A*<sup>k</sup> <sup>r</sup>*<sup>∗</sup>*w*,*w*(*s*), we first note that

> (*x* + *y*)*<sup>a</sup>* ≤ *x<sup>a</sup>* + *y<sup>a</sup>*, for any real *x*, *y* > 0 and *a* ≤ 1.

Since −(*s*) < 1, we have

$$\left(\mathbf{P}(w) + \mathbf{P}(w')\right)^{-\Re(s)} \le \mathbf{P}(w)^{-\Re(s)} + \mathbf{P}(w')^{-\Re(s)},\tag{89}$$

and

$$\begin{split} \left(\frac{S\_{w'}(1) - S\_{w,w'}(1)}{S\_{w'}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w'}(1)} \mathbf{P}(w) \mathfrak{R} \boldsymbol{\eta} + \frac{S\_{w}(1) - S\_{w',w}(1)}{S\_{w}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w}(1)} \mathbf{P}(w') \right)^{-\mathfrak{R}(s)} \\ \leq \left(\frac{S\_{w'}(1) - S\_{w,w'}(1)}{S\_{w}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w}(1)} \mathbf{P}(w) \right)^{-\mathfrak{R}(s)} \\ &+ \left(\frac{S\_{w}(1) - S\_{w',w}(1)}{S\_{w}(1)S\_{w'}(1) - S\_{w,w'}(1)S\_{w',w}(1)} \mathbf{P}(w') \right)^{-\mathfrak{R}(s)}. \end{split} \tag{90}$$

Therefore, we ge<sup>t</sup>

∑ *<sup>w</sup>*,*<sup>w</sup>*∈A*<sup>k</sup> <sup>w</sup>*=*w* |*r*<sup>∗</sup>*w*,*w*(*s*)|≤|Γ(*s*)|*O*(1) ∑*<sup>w</sup>*,*<sup>w</sup>*∈A*<sup>k</sup> <sup>w</sup>*=*w* **<sup>P</sup>**(*w*)−(*s*) 1 − -*Sw*(1)*Sw*(1) − *Sw*,*w*(1)*Sw*,*<sup>w</sup>*(1) *Sw*(1) − *Sw*,*w*(1) (*s*) + ∑ *<sup>w</sup>*,*<sup>w</sup>*∈A*<sup>k</sup> <sup>w</sup>*=*w* **<sup>P</sup>**(*w*)−(*s*) 1 − -*Sw*(1)*Sw*(1) − *Sw*,*w*(1)*Sw*,*<sup>w</sup>*(1) *Sw*(1) − *Sw*,*<sup>w</sup>*(1) (*s*) ≤ (*q<sup>k</sup>*)−(*s*)−<sup>1</sup>|Γ(*s*)|*O*(1) ∑*w*∈A*<sup>k</sup> <sup>w</sup>*=*w* ∑ *w*∈A*<sup>k</sup>* **<sup>P</sup>**(*w*) 1 − (*Sw*(1))(*s*) -1 − *Sw*,*w*(1) *Sw*(1) −(*s*) (91) + ∑ *w*∈A*<sup>k</sup> <sup>w</sup>*=*w* ∑ *w*∈A*<sup>k</sup>* **<sup>P</sup>**(*w*)*Sw*,*w*(1)(*s*) -*Sw*(1) − *Sw*,*w*(1) *Sw*,*<sup>w</sup>*(1) −(*s*) (92) + ∑ *w*∈A*<sup>k</sup> <sup>w</sup>*=*w* ∑ *w*∈A*<sup>k</sup>* **<sup>P</sup>**(*w*) 1 − (*Sw*(1))(*s*) -1 − *Sw*,*<sup>w</sup>*(1) *Sw*(1) −(*s*) (93) + ∑ *w*∈A*<sup>k</sup>*∑ *w*∈A*<sup>k</sup>***<sup>P</sup>**(*w*)*Sw*,*<sup>w</sup>*(1)(*s*) -*Sw*(1) − *Sw*,*<sup>w</sup>*(1) *Sw*,*w*(1) −(*s*) . (94)

By Lemma 10, with high probability, a randomly selected  $w$  has the property  $S\_{w, \mu^\prime}(1) = O(\delta^k)$ , and thus

*<sup>w</sup>*=*w*

$$\left(1 - \frac{S\_{\text{uv},\text{uv}'}(1)}{S\_{\text{uv}'}(1)}\right)^{-\Re(s)} = 1 + O(\delta^k).$$

With that and by Lemma 8, for most words *w*,

$$1 - S\_w(1)^{\Re(s)} (1 + O(\delta^k)) = O(\delta^k).$$

Therefore, both sums (91) and (93) are of the form (2*k* − <sup>1</sup>)*O*(*δ<sup>k</sup>*). The sums (92) and (94) are also of order (2*k* − 1)*O*(*δ<sup>k</sup>*) by Lemma 10. Combining all these terms we will obtain

$$\sum\_{\substack{w,w' \in \mathcal{A}^k \\ w \neq w'}} |r^\*\_{w,w'}(s)| \le (2^k - 1)(q^k)^{-\overline{\mathfrak{R}}(s) - 1} |\Gamma(s)| O(\delta^k) O(1). \tag{95}$$

By the inverse Mellin transform, for *k* = *a* log *n*, *M* = *a* log 2 +  and *c* ∈ (−1, *<sup>M</sup>*), we have

$$\sum\_{\substack{w,w' \in \mathcal{A}^k \\ w \neq w'}} r\_{w,w'}(z) = \frac{1}{2\pi i} \int\_{c-i\infty}^{c+i\infty} \left( \sum\_{\substack{w,w' \in \mathcal{A}^k \\ w \neq w'}} r\_{w,w'}(s) \right) z^{-s} ds = O(z^{-M}) O(2^k)$$

$$= O(z^{-c}). \tag{96}$$

In the following lemma we show that the first term in (85) is asymptotically small.

**Lemma 14.** *Recall that*

$$I\_n^{w,w'}(\rho) = \frac{1}{2\pi i} \int\_{|z|=\rho} \Delta\_{w,w'}(z) \frac{dz}{z^{n+1}}.$$

*We have*

$$\sum\_{\substack{w,w' \in \mathcal{A}^k \\ w \neq w'}} I\_n^{w,w'}(\rho) = O\left(\rho^{-n+2k}\delta^k\right). \tag{97}$$

.

**Proof.** First note that

$$\begin{split} \Delta\_{w,\mathcal{W}}(z) &= \frac{1}{1 - (1 - \mathsf{P}(w) - \mathsf{P}(w'))z} - \frac{S\_{w}(z)S\_{w'}(z) - S\_{w,\mathcal{W}}(z)S\_{w',\mathcal{W}}(z)}{D\_{w,\mathcal{W}'}(z)} \\ &= \frac{z\mathsf{P}(w)\left(S\_{w,\mathcal{W}}(z)S\_{w',\mathcal{W}}(z) - S\_{w}(z)S\_{w'}(z) + z^{k-1}S\_{w'}(z) - z^{k-1}S\_{w,\mathcal{W}}(z)\right)}{(1 - (1 - \mathsf{P}(w) - \mathsf{P}(w'))z)D\_{w,\mathcal{W}'}(z)} \\ &+ \frac{z\mathsf{P}(w')\left(S\_{w',\mathcal{W}}(z)S\_{w,\mathcal{W}}(z) - S\_{w'}(z)S\_{w}(z) + z^{k-1}S\_{w}(z) - z^{k-1}S\_{w',\mathcal{W}}(z)\right)}{(1 - (1 - \mathsf{P}(w) - \mathsf{P}(w'))z)D\_{w,\mathcal{W}'}(z)} .\end{split} \tag{98}$$

We saw in (73) that |1 − (1 − **<sup>P</sup>**(*w*))*z*| ≥ *c*2, and therefore, it follows that

$$|1 - (1 - \mathbf{P}(w) - \mathbf{P}(w'))z| \ge c\_1 \tag{99}$$

For *z* = *ρ*, |*Dw*,*w*(*z*)| is also bounded below as the following

$$\begin{split} |D\_{w,w'}(z)| &= \left| (1-z)(S\_{w}(z)S\_{w'}(z) - S\_{w,w'}(z)S\_{w',w}(z)) \right| \\ &\quad + z^{k} \left( \mathbb{P}(w)(S\_{w'}(z) - S\_{w,w'}(z)) + \mathbb{P}(w')(S\_{w}(z) - S\_{w',w}(z)) \right) | \\ &\geq \left| (1-z)(S\_{w}(z)S\_{w'}(z) - S\_{w,w'}(z)S\_{w',w}(z)) \right| \\ &\quad - \left| z^{k} \right| \left| \left( \mathbb{P}(w)(S\_{w'}(z) - S\_{w,w'}(z)) + \mathbb{P}(w')(S\_{w}(z) - S\_{w',w}(z)) \right) \right| \\ &\geq (\rho - 1)\beta - (p\rho)^{k} \left( \frac{2(1+p\rho)}{1-p\rho} \right), \end{split} \tag{100}$$

which is bounded away from zero by the assumption of Lemma 7. Additionally, we show that the numerator in (98) is bounded above, as follows

$$\begin{split} |S\_{w,w'}(z)S\_{w',w}(z) - S\_w(z)S\_{w'}(z) + z^{k-1}S\_{w'}(z) - z^{k-1}S\_{w,w'}(z)| &\leq \\ |S\_{w'}(z)(z^{k-1} - S\_{w}(z))| + |S\_{w,w'}(z)(S\_{w',w}(z) - z^{k-1})| \\ &\leq S\_{w'}(\rho) \left( (S\_w(\rho) - 1) + O(\rho^k) \right) + S\_{w,w'}(\rho) \left( S\_{w',w}(\rho) + O(\rho^k) \right). \end{split} \tag{101}$$

This yields

$$\sum\_{\substack{\boldsymbol{w},\boldsymbol{w}' \in \mathcal{A}^{k} \\ \boldsymbol{w} \neq \boldsymbol{w}'}} |I\_{\boldsymbol{n}}^{\boldsymbol{w},\boldsymbol{w}'}| \leq O(\boldsymbol{\rho}^{-n}) \sum\_{\substack{\boldsymbol{w}' \in \mathcal{A}^{k} \\ \boldsymbol{w} \neq \boldsymbol{w}'}} \mathbb{S}\_{\boldsymbol{w}'}(\boldsymbol{\rho}) \sum\_{\boldsymbol{w} \in \mathcal{A}^{k}} \mathsf{P}(\boldsymbol{w}) \left( (\mathsf{S}\_{\boldsymbol{w}}(\boldsymbol{\rho}) - 1) + O(\boldsymbol{\rho}^{k}) \right)$$

$$+ O(\boldsymbol{\rho}^{-n}) \sum\_{\substack{\boldsymbol{w}' \in \mathcal{A}^{k} \\ \boldsymbol{w} \neq \boldsymbol{w}'}} \sum\_{\boldsymbol{w} \in \mathcal{A}^{k}} \mathsf{P}(\boldsymbol{w}) \mathsf{S}\_{\boldsymbol{w},\boldsymbol{w}'}(\boldsymbol{\rho}) \left( \mathsf{S}\_{\boldsymbol{w}',\boldsymbol{w}}(\boldsymbol{\rho}) + O(\boldsymbol{\rho}^{k}) \right). \tag{102}$$

By (75), the first term above is of order (2*k* − <sup>1</sup>)*O*(*ρ*<sup>−</sup>*n*+*<sup>k</sup>*) and by Lemma 10 and an analysis similar to (75), the second term yields (2*k* − <sup>1</sup>)*O*(*ρ*<sup>−</sup>*n*+*<sup>k</sup>*) as well. Finally, we have

$$\sum\_{\substack{\boldsymbol{w},\boldsymbol{w}' \in \mathcal{A}^k \\ \boldsymbol{w} \neq \boldsymbol{w}'}} |I\_{\boldsymbol{n}}^{\boldsymbol{w},\boldsymbol{w}'}| \leq O(\boldsymbol{\rho}^{-\boldsymbol{n}+2k}\delta^k).$$

Which goes to zero asymptotically, for *k* = Θ(log *<sup>n</sup>*).

This lemma completes our proof of Theorem 2.

#### *3.5. Asymptotic Analysis of the kth Prefix Complexity*

We finally proceed to analyzing the asymptotic moments of the *k*th Prefix Complexity. The results obtained hold true for the moments of the *k*th Subword Complexity. Our methodology involves poissonization, saddle point analysis (the complex version of Laplace's method [23]), and depoissonization.

**Lemma 15** (Jacquet and Szpankowski, 1998)**.** *Let G* ˜(*z*) *be the Poisson transform of a sequence gn. If <sup>G</sup>*˜(*z*) *is analytic in a linear cone Sθ with θ* < *<sup>π</sup>*/2*, and if the following two conditions hold: (I) For z* ∈ *Sθ and real values B, r* > 0*, ν*

$$|z| > r \to |\bar{G}(z)| \le B|z^{\nu}|\Psi(|z|),\tag{103}$$

*where* <sup>Ψ</sup>(*x*) *is such that, for fixed t,* lim*x*→∞ Ψ(*tx*) <sup>Ψ</sup>(*x*) = 1*; (II) For z* ∈/ *Sθ and A*, *α* < 1

$$|z| > r \to |\vec{G}(z)e^z| \le Ae^{a|z|}. \tag{104}$$

*Then, for every non-negative integer n, we have*

$$\mathbf{g}\_n = \mathbf{\hat{G}}(n) + O(n^{\nu - 1} \mathbf{\hat{Y}}(n)).$$

**On the Expected Value:** To transform the sequence of interest, (**E**[*X*<sup>ˆ</sup> *<sup>n</sup>*,*<sup>k</sup>*])*n*≥0, into a Poisson model, we recall that in (25) we found

$$\mathbf{E}[\hat{\mathcal{X}}\_{n,k}] = \sum\_{w \in \mathcal{A}^k} \left( 1 - \left( 1 - \mathbf{P}(w) \right)^n \right).$$

Thus, the Poisson transform is

$$\begin{split} \bar{E}\_k(z) &= \sum\_{n=0}^{\infty} \mathbb{E}[\hat{\mathcal{X}}\_{n,k}] \frac{z^n}{n!} e^{-z} \\ &= \sum\_{n=0}^{\infty} \sum\_{w \in \mathcal{A}^k} \left( 1 - (1 - \mathbf{P}(w))^n \right) \frac{z^n}{n!} e^{-z} \\ &= \sum\_{w \in \mathcal{A}^k} \left( 1 - e^{-z \mathbf{P}(w)} \right) . \end{split} \tag{105}$$

To asymptotically evaluate this harmonic sum, we turn our attention to the Mellin Transform once more. The Mellin transform of *E* ˜ *k*(*z*) is

$$\begin{split} \tilde{E}\_k^\*(s) &= -\Gamma(s) \sum\_{w \in \mathcal{A}^k} P(w)^{-s} \\ &= -\Gamma(s) (p^{-s} + q^{-s})^k, \end{split} \tag{106}$$

which has the fundamental strip *s* ∈ −1, <sup>0</sup>. For *c* ∈ (−1, <sup>0</sup>), the inverse Mellin integral is the following

$$\begin{split} \tilde{E}\_k(z) &= \frac{1}{2\pi i} \int\_{c-i\infty}^{c+i\infty} \tilde{E}\_k^\*(s) \cdot z^{-s} ds \\ &= \frac{-1}{2\pi i} \int\_{c-i\infty}^{c+i\infty} z^{-s} \Gamma(s) (p^{-s} + q^{-s})^k ds \\ &= \frac{-1}{2\pi i} \int\_{c-i\infty}^{c+i\infty} \Gamma(s) e^{-k(s\frac{\log z}{k} - \log(p^{-s} + q^{-s}))} ds \\ &= \frac{-1}{2\pi i} \int\_{c-i\infty}^{c+i\infty} \Gamma(s) e^{-k\hbar(s)} ds, \end{split} \tag{107}$$

where we define *h*(*s*) = *sa* − log(*p*<sup>−</sup>*<sup>s</sup>* + *q*<sup>−</sup>*<sup>s</sup>*) for *k* = *a* log *z*. We emphasize that the above integral involves *k*, and *k* grows with *n*. We evaluate the integral through the saddle point analysis. Therefore, we choose the line of integration to cross the saddle point *r*0. To find the saddle point *r*0, we let *<sup>h</sup>*(*<sup>r</sup>*0) = 0, and we obtain

$$\left(p/q\right)^{-r\_0} = \frac{a\log p^{-1} - 1}{1 - a\log q^{-1}}\tag{108}$$

and therefore,

$$r\_0 = \frac{-1}{\log p/q} \log \left( \frac{a \log q^{-1} - 1}{1 - a \log p^{-1}} \right),\tag{109}$$

where 1 log *q*−<sup>1</sup> < *a* < 1 log *p*−<sup>1</sup> .

By (108) and the fact that (*p*/*q*)*itj* = 1 for *tj* = 2*πj* log *p*/*q* and *j* ∈ Z, we can see that there are actually infinitely many saddle points *zj* of the form *r*0 + *itj* on the line of integration.

We remark that the location of *r*0 depends on the value of *a*. We have *r*0 → ∞ as *a* → 1 log *q*−<sup>1</sup> , and *r*0 → −∞ as *a* → 1 log *p*−<sup>1</sup> . We divide the analysis into three parts, for the three ranges *r*0 ∈ (0, <sup>∞</sup>), *r*0∈ (−1,<sup>0</sup>),and *r*0∈ (−∞, <sup>−</sup><sup>1</sup>).

In the first range, which corresponds to

$$a \frac{1}{\log q^{-1}} < a < \frac{2}{\log q^{-1} + \log p^{-1}},\tag{110}$$

we perform a residue analysis, taking into account the dominant pole at *s* = −1. In the second range, we have

$$\frac{2}{\log q^{-1} + \log p^{-1}} < a < \frac{1}{q \log q^{-1} + p \log p^{-1}},\tag{111}$$

and we ge<sup>t</sup> the asymptotic result through the saddle point method. The last range corresponds to

$$\frac{1}{q\log q^{-1} + p\log p^{-1}} < a < \frac{1}{\log p^{-1}}.\tag{112}$$

and we approach it with a combination of residue analysis at *s* = 0, and the saddle point method. We now proceed by stating the proof of theorem 3.

**Proof of Theorem 3.** We begin with proving part *ii* which requires a saddle point analysis. We rewrite the inverse Mellin transform with integration line at (*s*) = *r*0 as

$$\begin{split} E\_k(z) &= \frac{-1}{2\pi} \int\_{-\infty}^{\infty} z^{-(r\_0+it)} \Gamma(r\_0+it) (p^{-(r\_0+it)} + q^{-(r\_0+it)})^k dt \\ &= \frac{-1}{2\pi} \int\_{-\infty}^{\infty} \Gamma(r\_0+it) e^{-k((r\_0+it)\frac{\log z}{k} - \log(p^{-(r\_0+it)} + q^{-(r\_0+it)}))} dt. \end{split} \tag{113}$$

#### **Step one: Saddle points' contribute to the integral estimation**

First, we are able to show those saddle points with |*tj*| > log *n* do not have a significant asymptotic contribution to the integral. To show this, we let

$$T\_k(z) = \int\_{|t|>\sqrt{\log n}} z^{-r\_0 - it} \Gamma(r\_0 + it) (p^{-r\_0 - it} + q^{-r\_0 - it})^k dt. \tag{114}$$

Since |Γ(*<sup>r</sup>*0 + *it*)| = *<sup>O</sup>*(|*t*|*<sup>r</sup>*0− 12 *e* −*<sup>π</sup>*|*t*| 2 ) as |*t*|→±<sup>∞</sup>, we observe that

$$\begin{split} T\_k(z) &= O\left( z^{-r\_0} (p^{-r\_0} + q^{-r\_0})^k \int\_{\sqrt{\log n}}^{\infty} t^{r\_0/2 - 1/2} e^{-\pi t/2} dt \right) \\ &= O\left( z^{-r\_0} (p^{-r\_0} + q^{-r\_0})^k (\log n)^{r\_0/4 - 1/4} \int\_{\sqrt{\log n}}^{\infty} e^{-\pi t/2} dt \right) \\ &= O\left( z^{-r\_0} (p^{-r\_0} + q^{-r\_0})^k (\log n)^{r\_0/4 - 1/4} e^{-\pi \sqrt{\log n}/2} \right) \\ &= O\left( (\log n)^{r\_0/4 - 1/4} e^{-\pi \sqrt{\log n}/2} \right), \end{split} \tag{115}$$

which is very small for large *n*. Note that for *t* ∈ (log *n*, <sup>∞</sup>), *t<sup>r</sup>*0/2−1/2 is decreasing, and bounded above by (log *n*)*r*0/4−1/4.

#### **Step two: Partitioning the integral**

There are now only finitely many saddle points to work with. We split the integral range into sub-intervals, each of which contains exactly one saddle point. This way, each integral has a contour traversing a single saddle point, and we will be able to estimate the dominant contribution in each integral from a small neighborhood around the saddle point. Assuming that *j*∗ is the largest *j* for which 2*πj* log *p*/*q* ≤ log *n*, we split the integral *<sup>E</sup>*˜*k*(*z*) as following

$$E\_k(z) = -\frac{1}{2\pi} \left( \sum\_{|j| < j^\*} \int\_{|t - t\_j| \le \frac{\pi}{\log p/q}} z^{-r\_0 + it} \Gamma(r\_0 + it) (p^{-r\_0 - it} + q^{-r\_0 - it})^k dt \right)$$

$$-\frac{1}{2\pi} \int\_{\frac{\pi}{\log p/q} \le |t\_j^\*| < \sqrt{\log n}} \Gamma(r + it) z^{-r\_0 + it} (p^{-r\_0 - it} + q^{-r\_0 - it})^k dt. \tag{116}$$

By the same argumen<sup>t</sup> as in (115), the second term in (116) is also asymptotically negligible. Therefore, we are only left with

$$\bar{E}\_k(z) = \sum\_{|j| < j^\*} S\_j(z),\tag{117}$$

where *Sj*(*z*) = − 12*π* <sup>|</sup>*<sup>t</sup>*−*tj*|≤ *π* log *p*/*q <sup>z</sup>*<sup>−</sup>*r*0+*it*Γ(*<sup>r</sup>*0 + *it*)(*p*<sup>−</sup>*r*0−*it* + *<sup>q</sup>*<sup>−</sup>*r*0−*it*)*kdt*).

#### **Step three: Splitting the saddle contour**

For each integral *Sj*, we write the expansion of *h*(*t*) about *tj*, as follows

$$h(t) = h(t\_j) + \frac{1}{2}h''(t\_j)(t - t\_j)^2 + O((t - t\_j)^3). \tag{118}$$

The main contribution for the integral estimate should come from an small integration path that reduces *kh*(*t*) to its quadratic expansion about *tj*. In other words, we want the integration path to be such that

$$k(t - t\_{\dot{f}})^2 \to \infty, \qquad \text{and} \qquad k(t - t\_{\dot{f}})^3 \to 0. \tag{119}$$

The above conditions are true when |*t* − *tj*| *k*−1/2 and |*t* − *tj*| *k*−1/3. Thus, we choose the integration path to be |*t* − *tj*| ≤ *k*−2/5. Therefore, we have

$$S\_{\bar{j}}(z) = -\frac{1}{2\pi} \int\_{|t-t\_j| \le k^{-2/3}} z^{-r\_0 + it} \Gamma(r\_0 + it) (p^{-r\_0 - it} + q^{-r\_0 - it})^k dt$$

$$-\frac{1}{2\pi} \int\_{k^{-2/3} < |t-t\_j| < \frac{\pi}{\log p/q}} z^{-r\_0 + it} \Gamma(r\_0 + it) (p^{-r\_0 - it} + q^{-r\_0 - it})^k dt. \tag{120}$$
