# Pointwise and correlation bounds on Dedekind sums over small subgroups

Bence Borda, Marc Munsch, Igor Shparlinski

► To cite this version:

Bence Borda, Marc Munsch, Igor Shparlinski. Pointwise and correlation bounds on Dedekind sums over small subgroups. Research in Number Theory, 2023, 10 (2), pp.28. 10.48550/arXiv.2305.04304. hal-04425134

HAL Id: hal-04425134

https://hal.science/hal-04425134v1

Submitted on 29 Jan 2024

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# POINTWISE AND CORRELATION BOUNDS ON DEDEKIND SUMS OVER SMALL SUBGROUPS

BENCE BORDA, MARC MUNSCH, AND IGOR E. SHPARLINSKI

ABSTRACT. We obtain new bounds, pointwise and on average, for Dedekind sums $s(\lambda, p)$ modulo a prime $p$ with $\lambda$ of small multiplicative order $d$ modulo $p$. Assuming the infinitude of Mersenne primes, the range of our results is optimal. Moreover, we relate high moments of $L(1, \chi)$ over subgroups of characters to some correlations of Dedekind sums, and use recent results of the second and third author to study these correlations.

## 1. INTRODUCTION

1.1. **Dedekind sums and moments of L-functions.** Given two integers $a$ and $b$ with

$$b \ge 1 \quad \text{and} \quad \gcd(a, b) = 1,$$

we define the *Dedekind sum*

$$s(a, b) = \sum_{c=1}^{b-1} \left(\left(\frac{c}{b}\right)\right) \left(\left(\frac{ac}{b}\right)\right),$$

where

$$((\xi)) = \begin{cases} \{\xi\} - 1/2, & \text{if } \xi \in \mathbb{R} \setminus \mathbb{Z}, \\ 0, & \text{if } \xi \in \mathbb{Z}. \end{cases}$$

Historically, Dedekind sums appeared in the context of modular forms to describe the transformation formula for the Dedekind eta function [23]. Since the seminal works of Vardi [24, 25], it is known that the distribution of the ratio $s(a, b)/\log b$ converges to the Cauchy distribution when averaged over pairs $\gcd(a, b) = 1$ and $1 \le b \le B$, with $B \to \infty$, see also [3, 12]. In particular, Dedekind sums are relatively small on average, but can also seldom take very large values which are responsible for the asymptotic of the moments, see, for instance, [8–10] and references therein. Both the study of the distribution

<footnote n="2020">2020 Mathematics Subject Classification. 11F20, 11J71, 11K38, 11M20.</footnote>

<footnote>Key words and phrases. Dedekind sum, L-function, multiplicative subgroup, continued fractions.</footnote>
of values of Dedekind sums [1, 7] as well as the study of restricted averages of Dedekind sums [20, 21] regained a lot of interest in recent years, in particular due to their applications to the analysis of some number theoretic algorithms. Let us also mention that Lemke Oliver and Soundararajan [15] have discovered a very interesting link between Dedekind sums and the distribution of primes.

We first observe that by the Cauchy–Schwarz inequality, we have the following trivial bound:

$$|\mathfrak{s}(a, b)| \le \mathfrak{s}(1, b) = \frac{(b-1)(b-2)}{12b} < \frac{b}{12}.$$

Here we are interested in non-trivial bounds on the sums $\mathfrak{s}(\lambda, p)$ depending on the multiplicative order of $\lambda$ modulo a prime $p$. In particular, this question is motivated by the connection with the second moments of Dirichlet $L$-functions $L(1, \chi)$ over multiplicative characters $\chi$ of a given order, as established in [16–19]. A link between the size of $\mathfrak{s}(a, b)$ and the order of a modulo $b$ was first established by Louboutin in [16, Lemma 6], which implies that for an odd

$$(1.1) \qquad b = (a^d - 1)/(a - 1)$$

with an integer $a \ne 0, \pm 1$ and a prime $d$, we have

$$\mathfrak{s}(a, b) = \frac{(b-1)(b-a^2-1)}{12ab} = O(b^{1-1/(d-1)}).$$

It is easy to see that $d$ is the order of $a$ modulo $b$.

More precisely, let $\mathbb{F}_p^*$ be the multiplicative group of the finite field $\mathbb{F}_p$ of $p$ elements, and let $\mathcal{X}_p$ be the group of multiplicative characters of $\mathbb{F}_p^*$.

Given an even integer $m$ with $m \mid p-1$ and a multiplicative subgroup $\mathcal{G}_m \subseteq \mathbb{F}_p^*$ of index $m$ and thus of order $(p-1)/m$, we denote by $\mathcal{X}_{p,m}$ the group of multiplicative characters of $\mathbb{F}_p^*$ which are trivial on $\mathcal{G}_m$. Furthermore, assuming that $(p-1)/m$ is odd, we consider the set of $m/2$ odd characters in $\mathcal{X}_{p,m}$, that is, the set

$$\mathcal{X}_{p,m}^{-} = \{\chi \in \mathcal{X}_{p,m} : \chi(-1) = -1\}.$$

We also set

$$\mathcal{X}_p^{-} = \mathcal{X}_{p,p-1}^{-}.$$

We now define the moments

$$M_{\nu}^{-}(p, m) = \frac{2}{m} \sum_{\chi \in \mathcal{X}_{p,m}^{-}} |L(1, \chi)|^{\nu}, \quad \nu = 1, 2, \dots,$$

where $L(s, \chi)$ is the Dirichlet $L$-function associated with a multiplicative character $\chi \in \mathcal{X}_p$.
By [27, Chapter 4], there is a close connection between the second moment $M_2^-(p, m)$ and the relative class number of the imaginary subfield of the cyclotomic field $\mathbb{Q}(\exp(2\pi i/p))$ of degree $m$ over $\mathbb{Q}$. In turn, by a result of Louboutin [16, Theorem 2], we have

$$ (1.2) \qquad M_2^-(p, m) = \frac{\pi^2}{6} \left( 1 - \frac{3}{p} + \frac{2}{p^2} + \frac{2}{p} S(p, m) \right), $$

where

$$ S(p, m) = \sum_{\substack{\lambda \in \mathcal{G}_m \\ \lambda \neq 1}} s(\lambda, p). $$

Hence the relation (1.2) and the above connection to the class number motivates studying the size of $s(\lambda, p)$ on elements $\lambda \in \mathbb{F}_p^*$ of given order as well as the size on average over a subgroup of $\mathbb{F}_p^*$. Moreover, using asymptotic formulas for $M_2^-(p, m)$ from [22], one immediately obtains upper bounds for $S(p, m)$. Here we derive several new results which go beyond this link.

**1.2. Summary of our results and methods.** We first improve a pointwise bound from [19] on Dedekind sums $s(\lambda, p)$, provided that $\lambda$ is of small multiplicative order in $\mathbb{F}_p^*$, see Corollary 2.2 below. It could be in principle used to improve the error term in the asymptotic formula for $M_2^-(p, m)$, provided that $m$ is not too small. However, the result is now superseded by a much more general result of the second and third authors [22, Theorem 2.1] obtained via different methods. It may have other applications, though. Under the assumption of the infinitude of *Mersenne primes*, the ranges where these results provide non-trivial estimates are optimal, see Remark 2.3.

Next, we generalise the formula (1.2) to higher moments relating $M_{2k}^-(p, m)$ to certain correlations between Dedekind sums (see, for example, Theorem 2.4 below), and use the results of [22] to get information on these sums.

Our methods involve the connection between Dedekind sums and *continued fractions* established independently by Barkan [4] and Hickerson [12] (see also a more general result of Knuth [13]).

**1.3. Notation and conventions.** We adopt the Vinogradov notation $\ll$, that is,

$$ A \ll B \iff B \gg A \iff A = O(B) \iff |A| \le cB $$

for some constant $c > 0$ which sometimes, where obvious, may depend on the integer parameter $k \ge 1$, and is absolute otherwise.
For a finite set $\mathcal{S}$, we use $\#\mathcal{S}$ to denote its cardinality. We also write $\|x\|$ to denote the distance from a real $x$ to the closest integer and, as usual, $\varphi(d)$ denotes the Euler function.

## 2. BOUNDS ON DEDEKIND SUMS

**2.1. Pointwise bounds on Dedekind sums.** We are now ready to present an improvement of [19, Theorem 3.1], which gives the bound

$$ (2.1) \qquad s(\lambda, p) \ll p^{1-1/\varphi(d)} (\log p)^2 $$

provided that $\lambda$ is of order $d \ge 3$ in $\mathbb{F}_p^*$. Here we remove the factor $(\log p)^2$, which gives an optimal range with respect to $d$ where one can hope for getting a non-trivial bound on $s(\lambda, p)$, see Remark 2.3.

We start with the following result about continued fractions of ratios with prime denominators, which might be of independent interest.

**Theorem 2.1.** Let $p$ be a prime, and assume that $\lambda \in \mathbb{F}_p^*$ has multiplicative order $d \ge 3$ in $\mathbb{F}_p^*$. The continued fraction expansion $\{\lambda/p\} = [0; a_1, \dots, a_n]$ satisfies

$$ \sum_{i=1}^{n} a_i \le 13.44 p^{1-1/\varphi(d)}. $$

Combining Theorem 2.1 with Lemma 3.2 below, we immediately derive the following bound, which establishes [19, Conjecture 7.1].

**Corollary 2.2.** Let $p$ be a prime, and assume that $\lambda \in \mathbb{F}_p^*$ has multiplicative order $d \ge 3$ in $\mathbb{F}_p^*$. Then

$$ |s(\lambda, p)| \le 1.12 p^{1-1/\varphi(d)}. $$

**Remark 2.3.** A quick computation shows that Theorem 2.1 and Corollary 2.2 are non-trivial (in other words, $\sum_{i=1}^n a_i = o(p)$ and $s(\lambda, p) = o(p)$) in the full range $\varphi(d) = o(\log p)$, while (2.1) is only non-trivial in the range $\varphi(d) \ll \log p/\log \log p$. Moreover, if $p = 2^d - 1$ is a Mersenne prime, then by [19, Equation (7.1)] we have $s(2, 2^d - 1) \sim p/24$, showing that $s(\lambda, p) = o(p)$, and thus by Lemma 3.2 we see that $\sum_{i=1}^n a_i = o(p)$, cannot hold in the range $\varphi(d) \asymp \log p$.

**2.2. Correlation of Dedekind sums.** We first generalise the formula (1.2) to higher moments, relating $M_{2k}^{-}(p, m)$ to certain correlations between Dedekind sums.

**Theorem 2.4.** Let $m$ $| p - 1$ be even. Then,

$$ M_{2k}^{-}(p, m) = \frac{2\pi^{2k}}{p^k} \sum_{\lambda \in \mathcal{G}_m} \sum_{t_1, \dots, t_{k-1}=1}^{p-1} s(t_1, p) \cdots s(t_{k-1}, p) s(\lambda t_1 \cdots t_{k-1}, p). $$
It may be useful to compare this when $\mathcal{G}_m = \{1\}$ with a result of Alkan [2, Theorem 2] on moments of $L(1, \chi)$ (rather than their absolute values) modulo a composite $q$. See also [5, 28] for works in the same spirit. Let $\tau_k$ denote the $k$-fold divisor function, that is,

$$ \tau_k(n) = \sum_{\substack{n_1 \cdots n_k = n \\ n_i \ge 1}} 1. $$

As usual, for $k=2$ we write $\tau = \tau_2$ for the usual divisor function.

Let us recall that by [22, Theorem 2.1] we know that for any $\kappa < 1$ we have

$$ (2.2) \qquad M_{2k}^{-}(p, m) = a(k) + O(p^{-\kappa/\varphi(d)} + p^{-1/4+o(1)}), $$

where

$$ a(k) = \sum_{n=1}^{+\infty} \frac{\tau_k^2(n)}{n^2}. $$

Combining Theorem 2.4 with (2.2) in the trivial case of $m = p - 1$, that is, for $\mathcal{G}_m = \{1\}$, implies

$$ (2.3) \qquad \sum_{t_1, \dots, t_{k-1} = 1}^{p-1} s(t_1, p) \cdots s(t_{k-1}, p) s(t_1 \cdots t_{k-1}, p) \\ = \left( \frac{a(k)}{2\pi^{2k}} + o(1) \right) p^k. $$

In the general case, Theorem 2.4 and the relations (2.2) and (2.3), yield the following result.

**Corollary 2.5.** Let $\mathcal{G}_m \subseteq \mathbb{F}_p^*$ be of index $m$ and of odd order $d = (p-1)/m$ such that $\varphi(d) = o(\log p)$. Then,

$$ \sum_{\substack{\lambda \in \mathcal{G}_m \\ \lambda \ne 1}} \sum_{t_1, \dots, t_{k-1} = 1}^{p-1} s(t_1, p) \cdots s(t_{k-1}, p) s(\lambda t_1 \cdots t_{k-1}, p) = o(p^k). $$

In fact, we see from (2.2) that the bound of Corollary 2.5 is of magnitude $O(p^{k-\kappa/\varphi(d)} + p^{k-1/4+o(1)})$ with any $\kappa < 1$.

In the case $k=2$, it is possible to give an independent proof of Corollary 2.5 using the pointwise bound of Corollary 2.7 below on correlations, which might be of independent interest. As in the case of $k=1$, we start with a result on the partial quotients of the continued fraction expansions of two multiplicatively related rational numbers.
**Theorem 2.6.** Let $p$ be a prime and $\lambda, t \in \mathbb{F}_p^*$, and assume that $\lambda$ has multiplicative order $d \ge 3$ in $\mathbb{F}_p^*$. Then the continued fraction expansions $\{\lambda t/p\} = [0; a_1, \dots, a_n]$ and $\{t/p\} = [0; b_1, \dots, b_\ell]$ satisfy

$$ \left( \sum_{i=1}^{n} a_i \right) \left( \sum_{j=1}^{\ell} b_j \right) \le 26.88 p^{2-1/\varphi(d)}. $$

As before, combining Theorem 2.6 with Lemma 3.2 below leads to the following bound.

**Corollary 2.7.** Let $p$ be a prime and $\lambda, t \in \mathbb{F}_p^*$, and assume that $\lambda$ has multiplicative order $d \ge 3$ in $\mathbb{F}_p^*$. Then

$$ |\mathfrak{s}(\lambda t, p)\mathfrak{s}(t, p)| < \frac{3}{16} p^{2-1/\varphi(d)}. $$

**Remark 2.8.** The bounds of Theorem 2.6 and Corollary 2.7 are non-trivial (in other words, $\sum_{i=1}^n a_i \sum_{j=1}^\ell b_j = o(p^2)$ and $\mathfrak{s}(\lambda t, p)\mathfrak{s}(t, p) = o(p^2)$) in the range $\varphi(d) = o(\log p)$.

Next, for integers $k_1, k_2 \bmod p$, we define the following averaged correlations of Dedekind sums

$$ S_{k_1, k_2}(p) = \sum_{t=1}^{p-1} \mathfrak{s}(k_1 t, p) \mathfrak{s}(k_2 t, p). $$

A direct application of the Cauchy–Schwarz inequality shows that

$$ (2.4) \qquad |S_{k_1, k_2}(p)| \le \sum_{t=1}^{p-1} \mathfrak{s}(t, p)^2 \ll p^2, $$

where we have used that a special case of [29, Theorem 1] gives the asymptotic formula

$$ (2.5) \qquad \sum_{t=1}^{p-1} \mathfrak{s}(t, p)^2 = \frac{5}{144} p^2 + O(p^{1+o(1)}). $$

By Theorem 2.4 (with $k=2$) and (2.5) we have

$$ \begin{aligned} M_4^-(p, m) &= \frac{2\pi^4}{p^2} \sum_{\lambda \in \mathcal{G}_m} S_{\lambda, 1}(p) \\ &= \frac{5}{144} p^2 + \frac{2\pi^4}{p^2} \sum_{\substack{\lambda \in \mathcal{G}_m \\ \lambda \ne 1}} S_{\lambda, 1}(p) + O(p^{1+o(1)}). \end{aligned} $$

Corollary 2.5 shows that the Dedekind sums $\mathfrak{s}(\lambda t, p)$ and $\mathfrak{s}(t, p)$ do not correlate in a strong form when averaged over both $t \in \mathbb{F}_p^*$ and $\lambda \in \mathbb{F}_p^*$.
$G_m \setminus \{1\}$. Indeed, Corollary 2.5 improves the trivial bound $dp^2$ by (2.4) for $S_{\lambda,1}(p)$ on average over $\lambda \in G_m \setminus \{1\}$, and gives

$$ \sum_{\substack{\lambda \in G_m \\ \lambda \neq 1}} S_{\lambda,1}(p) \ll p^{2-1/(2\varphi(d))} + p^{7/4+o(1)}. $$

On the other hand, we prove that for given integers $k_1, k_2 \ge 1$ which are not too large, the Dedekind sums $s(k_1t, p)$ and $s(k_2t, p)$ have a large correlation when averaged over $t$ modulo $p$, thus the trivial bound (2.4) is the best possible. This is directly related to the twisted fourth moment of $L$-functions over the full group of characters (see the formula (4.4) below).

**Theorem 2.9.** For any fixed $\varepsilon > 0$ and arbitrary coprime integers $k_1 \ge k_2 \ge 1$ with $k_1^3 k_2^2 \le p^{1-\varepsilon}$ we have, as $p \to \infty$,

$$ S_{k_1,k_2}(p) = (1 + o(1)) \frac{p^2}{\pi^4} \sum_{n=1}^{\infty} \frac{\tau(k_1 n) \tau(k_2 n)}{k_1 k_2 n^2}. $$

### 3. PRELIMINARIES

**3.1. Dedekind sums and continued fractions.** We recall that by a result of Barkan [4, Equation (13)] and Hickerson [12, Theorem 1] we have the following connection between Dedekind sums and continued fractions.

**Lemma 3.1.** Let $1 \le a < b$ be integers, and let $a/b = [0; a_1, \dots, a_n]$ be the continued fraction expansion with $a_n > 1$. Then

$$ s(a, b) = \frac{(-1)^n - 1}{8} + \frac{1}{12} \left( \frac{a}{b} + (-1)^{n+1} [0; a_n, \dots, a_1] + \sum_{i=1}^{n} (-1)^{i+1} a_i \right). $$

In fact, we only need the following upper bound.

**Lemma 3.2.** Let $1 \le a < b$ be integers, and let $a/b = [0; a_1, \dots, a_n]$ be the continued fraction expansion with $a_n > 1$. Then

$$ |s(a, b)| \le \frac{1}{12} \sum_{i=1}^{n} a_i. $$

*Proof.* Note that $a/b$ and $[0; a_n, \dots, a_1]$ both lie in the interval $[0, 1]$. For even $n$, Lemma 3.1 gives

$$ \begin{aligned} s(a, b) &= \frac{1}{12} \left( \frac{a}{b} - [0; a_n, \dots, a_1] + \sum_{i=1}^{n} (-1)^{i+1} a_i \right) \\ &\le \frac{1}{12} (a_1 + a_3 + \dots + a_{n-1}), \end{aligned} $$
and

$$s(a, b) \geq \frac{1}{12}(-a_2 - a_4 - \cdots - a_n),$$

which immediately imply the claim. For odd $n \geq 3$, we similarly deduce from Lemma 3.1 that

$$s(a, b) = -\frac{1}{4} + \frac{1}{12} \left( \frac{a}{b} + [0; a_n, \dots, a_1] + \sum_{i=1}^{n} (-1)^{i+1} a_i \right) \\ \leq \frac{1}{12} (a_1 + a_3 + \dots + a_n),$$

and

$$s(a, b) \geq -\frac{1}{4} + \frac{1}{12}(a_1 + a_3 - a_2 - a_4 - \dots - a_{n-1}) \\ \geq \frac{1}{12}(-1 - a_2 - a_4 - \dots - a_{n-1}),$$

and the claim follows. Finally, for $n = 1$ the assumption $a_1 \geq 2$ implies

$$s(a, b) = -\frac{1}{4} + \frac{1}{12} \left( \frac{1}{a_1} + \frac{1}{a_1} + a_1 \right) \in [0, \frac{a_1}{12}],$$

as claimed.

<figure><img src="image_2.png" /></figure>

**3.2. Small solutions to linear congruences.** We need the following result. A similar estimate has been shown in the proof of [18, Lemma 4.6], but here we give a simple proof which also produces better numerical constants.

**Lemma 3.3.** Assume that $\lambda$ has multiplicative order $d \geq 3$ in $\mathbb{F}_p^*$. Then,

$$\min\{|m| + |h| : h\lambda \equiv m \pmod{p}, (h, m) \neq (0, 0)\} \geq p^{1/\varphi(d)}.$$

*Proof.* Clearly $\Phi_d(\lambda) = 0$ (in $\mathbb{F}_p$), where $\Phi_d(X) \in \mathbb{Z}[X]$ is the $d$-th cyclotomic polynomial.

We now fix an integer pair $(h, m) \neq (0, 0)$ with $h\lambda \equiv m \pmod{p}$. Since $d \geq 3$, the polynomial $\Phi_d$ has no rational roots (as all its roots are roots of unity of order $d$). Therefore, $A = h^{\varphi(d)}\Phi_d(m/h)$ is a non-zero integer.

On the other hand,

$$A = h^{\varphi(d)}\Phi_d(m/h) \equiv h^{\varphi(d)}\Phi_d(\lambda) \equiv 0 \pmod{p}.$$

Hence

$$p \leq |A| = \prod_{\substack{j=1 \\ \gcd(j,d)=1}}^{d} |m - he^{2\pi ij/d}| \leq (|m| + |h|)^{\varphi(d)},$$
which concludes the proof.

<figure><img src="image_3.png" /></figure>

## 4. PROOFS OF RESULTS ON DEDEKIND SUMS

### 4.1. Proof of Theorem 2.1.
Let $1 \le h \le p-1$ be any integer, and let $h\lambda \equiv m \pmod{p}$ with $-(p-1)/2 < m \le (p-1)/2$. Then $\|h\lambda/p\| = |m|/p$. By Lemma 3.3, we have

$$p^{1/\varphi(d)} \le |h| + |m| = |h| + p \left\| \frac{h\lambda}{p} \right\|.$$

We can certainly assume that $1 \le \lambda \le p-1$. Let $p_i/q_i = [0; a_1, \dots, a_i]$ denote the convergents to $\lambda/p = [0; a_1, \dots, a_n]$. From the general properties of continued fractions, see, for example, [11, Theorem 164], we have

$$\left| \frac{\lambda}{p} - \frac{p_{i-1}}{q_{i-1}} \right| \le \frac{1}{q_{i-1}q_i} = \frac{1}{q_{i-1}(a_i q_{i-1} + q_{i-2})} \le \frac{1}{a_i q_{i-1}^2},$$

hence $\|q_{i-1}\lambda/p\| \le 1/(a_i q_{i-1})$. In particular, for any $1 \le i \le n$,

$$(4.1) \qquad p^{1/\varphi(d)} \le q_{i-1} + p \left\| \frac{q_{i-1}\lambda}{p} \right\| \le q_{i-1} + \frac{p}{a_i q_{i-1}}.$$

Consider the following two cases. If $q_{i-1} \le p^{1/\varphi(d)}/2$, then (4.1) implies that

$$a_i \le \frac{2p^{1-1/\varphi(d)}}{q_{i-1}}.$$

If $q_{i-1} > p^{1/\varphi(d)}/2$, then

$$a_i \le q_i/q_{i-1} \le p/q_{i-1}.$$

Therefore

$$\begin{align*}
\sum_{i=1}^{n} a_i &= \sum_{\substack{i=1 \\ q_{i-1} \le p^{1/\varphi(d)}/2}}^{n} a_i + \sum_{\substack{i=1 \\ q_{i-1} > p^{1/\varphi(d)}/2}}^{n} a_i \\
&\le \sum_{i=1}^{n} \frac{2p^{1-1/\varphi(d)}}{q_{i-1}} + \sum_{\substack{i=1 \\ q_{i-1} > p^{1/\varphi(d)}/2}}^{n} \frac{p}{q_{i-1}}.
\end{align*}$$

Using the inequality

$$q_{j+i-1} \ge q_j F_i,$$

where $F_i$ are the Fibonacci numbers, which is immediate from the identity $q_{i+2} = a_{i+2}q_{i+1} + q_i$, we derive

$$\sum_{i=1}^{n} a_i \le \left( 4 \sum_{i=1}^{\infty} \frac{1}{F_i} \right) p^{1-1/\varphi(d)} = 13.4395 \dots p^{1-1/\varphi(d)},$$
which concludes the proof.

4.2. **Proof of Theorem 2.4.** We recall the formula from [26, Equation (3)]

$$ (4.2) \quad \sum_{r,t=1}^{p-1} \left( \left( \frac{r}{p} \right) \right) \left( \left( \frac{t}{p} \right) \right) \bar{\chi}(r) \chi(t) = \begin{cases} \frac{p}{\pi^2} |L(1, \chi)|^2, & \text{if } \chi(-1) = -1, \\ 0, & \text{otherwise.} \end{cases} $$

Summing over characters and using orthogonality relations, we derive

$$ \begin{aligned} & \frac{p^k}{\pi^{2k}} \sum_{\chi \in \chi_{p,m}^{-}} |L(1, \chi)|^{2k} \\ &= \sum_{\chi \in \chi_{p,m}} \sum_{\substack{x_1, \dots, x_k=1 \\ y_1, \dots, y_k=1}}^{p-1} \prod_{i=1}^{k} \left(\left(\frac{x_i}{p}\right)\right) \left(\left(\frac{y_i}{p}\right)\right) \chi(x_i) \bar{\chi}(y_i) \\ &= \#\chi_{p,m} \sum_{\substack{\lambda \in \mathcal{G}_m \\ x_1 \cdots x_k \equiv \lambda y_1 \cdots y_k \mod p}} \sum_{\substack{x_1, \dots, x_k=1 \\ y_1, \dots, y_k=1}}^{p-1} \prod_{i=1}^{k} \left(\left(\frac{x_i}{p}\right)\right) \left(\left(\frac{y_i}{p}\right)\right). \end{aligned} $$

For any $1 \le i \le k - 1$, we make the change of variables $y_i = x_i t_i$. Hence, for every $\lambda \in \mathcal{G}_m$ we obtain

$$ \begin{aligned} & \sum_{\substack{x_1, \dots, x_k=1 \\ y_1, \dots, y_k=1}}^{p-1} \prod_{i=1}^{k} \left(\left(\frac{x_i}{p}\right)\right) \left(\left(\frac{y_i}{p}\right)\right) \\ & \qquad x_1 \cdots x_k \equiv \lambda y_1 \cdots y_k \mod p \\ &= \sum_{\substack{x_1, \dots, x_k=1 \\ t_1, \dots, t_{k-1}, y_k=1 \\ x_k \equiv \lambda t_1 \cdots t_{k-1} y_k \mod p}}^{p-1} \left(\left(\frac{y_k}{p}\right)\right) \left(\left(\frac{x_k}{p}\right)\right) \prod_{i=1}^{k-1} \left(\left(\frac{x_i}{p}\right)\right) \left(\left(\frac{x_i t_i}{p}\right)\right) \\ &= \sum_{\substack{x_1, \dots, x_{k-1}=1 \\ t_1, \dots, t_{k-1}, y_k=1}}^{p-1} \left(\left(\frac{y_k}{p}\right)\right) \left(\left(\frac{\lambda t_1 \cdots t_{k-1} y_k}{p}\right)\right) \prod_{i=1}^{k-1} \left(\left(\frac{x_i}{p}\right)\right) \left(\left(\frac{x_i t_i}{p}\right)\right) \\ &= \sum_{t_1, \dots, t_{k-1}=1}^{p-1} s(t_1, p) \cdots s(t_{k-1}, p) s(\lambda t_1 \cdots t_{k-1}, p). \end{aligned} $$
Thus, in accordance with (1.2), we derive

$$ \frac{p^k}{\pi^{2k}} \sum_{\chi \in \chi_{p,m}^{-}} |L(1, \chi)|^{2k} \\ = \# \chi_{p,m} \sum_{\lambda \in \mathcal{G}_m} \sum_{t_1, \dots, t_{k-1} = 1}^{p-1} s(t_1, p) \cdots s(t_{k-1}, p) s(\lambda t_1 \cdots t_{k-1}, p), $$

which finishes the proof of Theorem 2.4.

4.3. **Proof of Theorem 2.6.** Let $h_1, h_2 \in [1, p-1]$ be any integers, and let $h_1\lambda t \equiv m_1 \pmod p$ and $h_2t \equiv m_2 \pmod p$ with $m_1, m_2 \in (-(p-1)/2, (p-1)/2]$. Then $\|h_1\lambda t/p\| = |m_1|/p$ and $\|h_2t/p\| = |m_2|/p$. Observe that $h_2m_1 - \lambda h_1m_2 \equiv 0 \pmod p$. Therefore by Lemma 3.3,

$$ p^{1/\varphi(d)} \le |h_2m_1| + |h_1m_2| = |h_2|p \left\| \frac{h_1\lambda t}{p} \right\| + |h_1|p \left\| \frac{h_2t}{p} \right\|. $$

Let $p_i/q_i = [0; a_1, \dots, a_i]$ denote the convergents to $\{\lambda t/p\}$, and $\tilde{p}_j/\tilde{q}_j = [0; b_1, \dots, b_j]$ the convergents to $\{t/p\}$. In particular, for any $1 \le i \le n$ and $1 \le j \le l$, we derive

$$ p^{1/\varphi(d)} \le \tilde{q}_{j-1} p \left\| \frac{q_{i-1} \lambda t}{p} \right\| + q_{i-1} p \left\| \frac{\tilde{q}_{j-1} t}{p} \right\| \le 2p \max \left\{ \frac{\tilde{q}_{j-1}}{a_i q_{i-1}}, \frac{q_{i-1}}{b_j \tilde{q}_{j-1}} \right\}. $$

Taking the reciprocals yields

$$ 2p^{1-1/\varphi(d)} \ge \min \left\{ \frac{a_i q_{i-1}}{\tilde{q}_{j-1}}, \frac{b_j \tilde{q}_{j-1}}{q_{i-1}} \right\}. $$

Letting

$$ \mathcal{H} = \left\{ (i, j) \in [1, n] \times [1, l] : \frac{a_i q_{i-1}}{\tilde{q}_{j-1}} \le \frac{b_j \tilde{q}_{j-1}}{q_{i-1}} \right\}, $$

we have

$$ \begin{aligned} \sum_{i=1}^{n} a_i \sum_{j=1}^{l} b_j &= \sum_{(i,j) \in \mathcal{H}} a_i b_j + \sum_{(i,j) \notin \mathcal{H}} a_i b_j \\ &\le \sum_{(i,j) \in \mathcal{H}} 2p^{1-1/\varphi(d)} \frac{\tilde{q}_{j-1}}{q_{i-1}} b_j + \sum_{(i,j) \notin \mathcal{H}} a_i 2p^{1-1/\varphi(d)} \frac{q_{i-1}}{\tilde{q}_{j-1}} \\ &\le 2p^{1-1/\varphi(d)} \left( \sum_{i=1}^{n} \frac{1}{q_{i-1}} \sum_{j=1}^{l} b_j \tilde{q}_{j-1} + \sum_{i=1}^{n} a_i q_{i-1} \sum_{j=1}^{l} \frac{1}{\tilde{q}_{j-1}} \right). \end{aligned} $$
Using that

$$ \sum_{i=1}^{n} a_i q_{i-1} = q_n + q_{n-1} - 1 \le 2p \quad \text{and} \quad \sum_{j=1}^{\ell} b_j \tilde{q}_{j-1} = \tilde{q}_{\ell} + \tilde{q}_{\ell-1} - 1 \le 2p, $$

we now derive

$$ \sum_{i=1}^{n} a_i \sum_{j=1}^{\ell} b_j \le 8p^{2-1/\varphi(d)} \sum_{i=1}^{\infty} \frac{1}{F_i} = 26.8790 \dots p^{2-1/\varphi(d)}, $$

where, as before, $F_i$ are the Fibonacci numbers, which concludes the proof.

**4.4. Proof of Theorem 2.9.** For any integers $k_1, k_2 \ge 1$ let us define the following twisted fourth moments

$$ M_4^-(p; k_1, k_2) = \frac{2}{p-1} \sum_{\chi \in \chi_p^-} \chi(k_1) \bar{\chi}(k_2) |L(1, \chi)|^4, $$

$$ M_4(p; k_1, k_2) = \frac{1}{p-1} \sum_{\chi \in \chi_p^*} \chi(k_1) \bar{\chi}(k_2) |L(1, \chi)|^4, $$

where $\chi_p^* = \chi_p \setminus \{\chi_0\}$ denotes the set of all non-principal characters modulo $p$. Then, by [14, Theorem 1.1] uniformly over $k_1, k_2 \ge 1$, we have the following asymptotic formula

$$ (4.3) \quad M_4(p; k_1, k_2) = \sum_{\substack{n \in \mathbb{Z} \\ n \ne 0}} \frac{\tau(k_1 n) \tau(k_2 n)}{k_1 k_2 n^2} + O\left(\sqrt{k_1 + k_2 p^{-1/2+o(1)}}\right). $$

It follows from the proof of [14, Theorem 1.1] that $M_4^-(p; k_1, k_2)$ satisfies the same asymptotic formula (4.3) as $M_4(p; k_1, k_2)$. That is,

$$ (4.4) \quad M_4^-(p; k_1, k_2) = \sum_{\substack{n \in \mathbb{Z} \\ n \ne 0}} \frac{\tau(k_1 n) \tau(k_2 n)}{k_1 k_2 n^2} + O\left(\sqrt{k_1 + k_2 p^{-1/2+o(1)}}\right). $$

We now recall (4.2). Hence, summing over characters, we derive, similarly as in the proof of Theorem 2.4,

$$ \frac{p^2}{\pi^4} \sum_{\chi \in \chi_p^-} \chi(k_1) \bar{\chi}(k_2) |L(1, \chi)|^4 $$

$$ = (p-1) \sum_{\substack{r,s,t,u=1 \\ k_1rt \equiv k_2su \mod p}}^{p-1} \left(\left(\frac{r}{p}\right) \left(\frac{t}{p}\right) \left(\frac{s}{p}\right) \left(\frac{u}{p}\right)\right). $$
Making the change of variables $t \to k_2st$, we have

$$ 
\begin{aligned}
& \frac{p^2}{\pi^4} \sum_{\chi \in \chi_p^-} \chi(k_1) \bar{\chi}(k_2) |L(1, \chi)|^4 \\
&= (p-1) \sum_{\substack{r,s,t,u=1 \\ k_1rt \equiv u \pmod{p}}}^{p-1} \left(\left(\frac{r}{p}\right)\right) \left(\left(\frac{s}{p}\right)\right) \left(\left(\frac{k_2st}{p}\right)\right) \left(\left(\frac{u}{p}\right)\right) \\
&= (p-1) \sum_{r,s,t=1}^{p-1} \left(\left(\frac{r}{p}\right)\right) \left(\left(\frac{s}{p}\right)\right) \left(\left(\frac{k_2st}{p}\right)\right) \left(\left(\frac{k_1rt}{p}\right)\right).
\end{aligned}
$$

Next, we change $s \to k_2^{-1}s$, and we derive

$$ 
\begin{aligned}
& \frac{p^2}{\pi^4} \sum_{\chi \in \chi_p^-} \chi(k_1) \bar{\chi}(k_2) |L(1, \chi)|^4 \\
&= (p-1) \sum_{r,s,t=1}^{p-1} \left(\left(\frac{r}{p}\right)\right) \left(\left(\frac{k_2^{-1}s}{p}\right)\right) \left(\left(\frac{st}{p}\right)\right) \left(\left(\frac{k_1rt}{p}\right)\right) \\
&= (p-1) \sum_{t=1}^{p-1} s(k_1t, p) s(k_2t, p).
\end{aligned}
$$

Hence, we obtain

$$ \frac{p^2}{\pi^4} \sum_{\chi \in \chi_p^-} \chi(k_1) \bar{\chi}(k_2) |L(1, \chi)|^4 = (p-1) \sum_{t=1}^{p-1} s(\mathfrak{t}k_1, p) s(\mathfrak{t}k_2, p), $$

which together with (4.4) and using that $k_1 \ge k_2$, concludes the proof.

## 5. COMMENTS

Note that when we bound the Dedekind sum from above in terms of the sum of partial quotients, we ignore the cancellation in the alternating sum of partial quotients in Lemma 3.1. However, we might speculate that there is no such cancellation in the extremal cases. Indeed, let us look at the aforementioned example (1.1). For a fixed prime $d$, we expect $p = \frac{a^{d-1}}{a-1}$ to be prime for infinitely many $a$. Notice that the continued fraction expansion is $a/p = [0; a_1, a_2]$ with

$$ a_1 = \frac{a^{d-1}-1}{a-1} = a^{d-2} + \cdots + a + 1 \quad \text{and} \quad a_2 = a. $$

Thus

$$ a_1 + a_2 \sim a^{d-2} \sim p^{(d-2)/(d-1)} = p^{1-1/\varphi(d)} $$
and $s(a, p) \sim \frac{1}{12}p^{1-1/\phi(d)}$ as $a \to \infty$ by Lemma 3.1. In particular, the best possible constant in the upper bound in Theorem 2.1 is between 1 and 13.44. Numerical evidence in [19, Section 7] suggests that this example is indeed extremal for Dedekind sums. We thus conjecture that the best possible constant in the upper bound in Corollary 2.2 is 1/12 instead of 1.12.

## ACKNOWLEDGEMENT

The authors would like to thank Sandro Bettin for pointing out the reference [6] which may be useful to obtain an alternative proof of Corollary 2.5 for $k=2$. The authors are also grateful to Stéphane Louboutin for useful comments and to the anonymous referee for pointing out a way to improve Lemma 3.3 leading to a better constant in Corollary 2.2.

During the preparation of this work B.B. was supported by the Austrian Science Fund (FWF) project M 3260-N, M.M. by the Ministero della Istruzione e della Ricerca Young Researchers Program Rita Levi Montalcini and I.S. by the Australian Research Council Grants DP230100530 and DP230100534.

## DATA AVAILABILITY STATEMENT

Data sharing not applicable to this article as no datasets were generated or analysed during the current study.

## CONFLICT OF INTEREST STATEMENT

All authors declare that they have no conflicts of interest.

## REFERENCES

[1] C. Aistleitner, B. Borda and M. Hauke, ‘On the distribution of partial quotients of reduced fractions with fixed denominator’, *Trans. Amer. Math. Soc.*, **377** (2024), 1371–1408.

[2] E. Alkan, ‘Averages of values of L-series’, *Proc. Amer. Math. Soc.*, **141** (2013), 1161–1175.

[3] W. D. Banks and I. E. Shparlinski, ‘Fractional parts of Dedekind sums’, *Intern. J. Number Theory*, **5** (2016), 1137–1147.

[4] P. Barkan, ‘Sur les sommes de Dedekind et les fractions continues finies’, *C. R. Acad. Sci. Paris, Sér. A-B*, **284** (1977), A923–A926.

[5] A. Bayad and A. Raouj, ‘Mean values of L-functions and Dedekind sums’, *J. Number Theory*, **132** (2012), 1645–1652.

[6] S. Bettin, ‘High moments of the Estermann function’, *Algebra and Number Theory*, **13** (2019), 251–300.
[7] S. Bettin and S. Drappeau, 'Limit laws for rational continued fractions and value distribution of quantum modular forms', Proc. Lond. Math. Soc., **125** (2022), 1377-1425. 1

[8] J. B. Conrey, E. Fransen, R. Klein and C. Scott, 'Mean values of Dedekind sums', J. Number Theory, **56** (1996), 214-226. 1

[9] K. Girstmair, 'Zones of large and small values for Dedekind sums', Acta Arith., **109** (2003), 299-308. 1

[10] K. Girstmair, 'Continued fractions and Dedekind sums: Three-term relations and distribution', J. Number Theory, **119** (2006), 66-85. 1

[11] G. H. Hardy and E. M. Wright, An introduction to the theory of numbers, Oxford Univ. Press, Oxford, 2008. 9

[12] D. Hickerson, 'Continued fractions and density results for Dedekind sums', J. Reine Angew. Math., **290** (1977), 113-116. 1, 3, 7

[13] D. Knuth, 'Notes on generalized Dedekind sums', Acta Arith., **33** (1973), 297-325. 3

[14] S. H. Lee and S. Lee, 'The twisted moments and distribution of values of Dirichlet $L$-functions at 1', J. Number Theory, **197** (2019), 168-184. 12

[15] R. J. Lemke Oliver and K. Soundararajan, 'The distribution of consecutive prime biases and sums of sawtooth random variables', Math. Proc. Cambridge Philos. Soc., **168** (2020), 149-169. 2

[16] S. Louboutin, 'Dedekind sums, mean square value of $L$-functions at $s=1$ and upper bounds on relative class numbers', Bull. Pol. Acad. Sci. Math., **64** (2016), 165-174. 2, 3

[17] S. Louboutin, 'Mean square value of $L$-functions at $s=1$ for non-primitive characters, Dedekind sums and bounds on relative class numbers', Funct. Approx. Comment. Math., **68** (2023), 101-112. 2

[18] S. Louboutin and M. Munsch, 'Second moment of Dirichlet $L$-functions, character sums over subgroups and upper bounds on relative class numbers', Quart. J. Math., **72** (2021), 1379-1399. 2, 8

[19] S. Louboutin and M. Munsch, 'Mean square values of $L$-functions over subgroups for nonprimitive characters, Dedekind sums and bounds on relative class numbers', Canad. J. Math., **75** (2023), 1711-1743. 2, 3, 4, 14

[20] P. Minelli, A. Sourmelidis and M. Technau, 'Bias in the number of steps in the Euclidean algorithm and a conjecture of Ito on Dedekind sums', Math. Ann., **387** (2023), 291-320. 2

[21] P. Minelli, A. Sourmelidis and M. Technau, 'On restricted averages of Dedekind sums', Int. Math. Res. Not. IMRN, (to appear). 2

[22] M. Munsch and I. E. Shparlinski, 'Moments and non-vanishing of $L$-functions over subgroups', Preprint, 2023, (available from https://arxiv.org/abs/2309.10207). 3, 5

[23] H. Rademacher and E. Grosswald, *Dedekind sums*, Carus Math. Monograph, Math. Assoc. Amer., 1972. 1

[24] I. Vardi, 'A relation between Dedekind sums and Kloosterman sums', Duke Math. J., **55** (1987), 189-197. 1

[25] I. Vardi, 'Dedekind sums have a limiting distribution', Int. Math. Res. Not., **1993** (1993), 1-12. 1

[26] H. Walum, 'An exact formula for an average of $L$-series', Illinois J. Math., **26** (1982), 1-3. 10
[27] L. C. Washington, *Introduction to cyclotomic fields*, Graduate Texts in Math., vol. 83, Springer, New York, 1982. 3

[28] D. Zagier, 'Higher dimensional Dedekind sums', *Math. Ann.*, **202** (1973), 149–172. 5

[29] W. Zhang, 'On the mean values of Dedekind sums', *J. Théorie Nombr. Bordeaux*, **8** (1996), 429–442. 6

INSTITUTE OF ANALYSIS AND NUMBER THEORY, TECHNISCHE UNIVERSITÄT GRAZ, STEYRERGASSE 30, 8010 GRAZ, AUSTRIA

Email address: borda@math.tugraz.at

INSTITUT CAMILLE JORDAN, UNIVERSITÉ JEAN MONNET, 23, RUE DU DOCTEUR PAUL MICHELON, 42 023 SAINT-ETIENNE CEDEX 2, FRANCE

Email address: marc.munsch@univ-st-etienne.fr

SCHOOL OF MATHEMATICS AND STATISTICS, UNIVERSITY OF NEW SOUTH WALES, SYDNEY, NSW 2052, AUSTRALIA

Email address: igor.shparlinski@unsw.edu.au