Mean square values of $L$-functions over subgroups for non primitive characters, Dedekind sums and bounds on relative class numbers

An explicit formula for the mean value of $\vert L(1,\chi)\vert^2$ is known, where $\chi$ runs over all odd primitive Dirichlet characters of prime conductors $p$. Bounds on the relative class number of the cyclotomic field ${\mathbb Q}(\zeta_p)$ follow. Lately the authors obtained that the mean value of $\vert L(1,\chi)\vert^2$ is asymptotic to $\pi^2/6$, where $\chi$ runs over all odd primitive Dirichlet characters of prime conductors $p\equiv 1\pmod{2d}$ which are trivial on a subgroup $H$ of odd order $d$ of the multiplicative group $({\mathbb Z}/p{\mathbb Z})^*$, provided that $d\ll\frac{\log p}{\log\log p}$. Bounds on the relative class number of the subfield of degree $\frac{p-1}{2d}$ of the cyclotomic field ${\mathbb Q}(\zeta_p)$ follow. Here, for a given integer $d_0>1$ we consider the same questions for the non-primitive odd Dirichlet characters $\chi'$ modulo $d_0p$ induced by the odd primitive characters $\chi$ modulo $p$. We obtain new estimates for Dedekind sums and deduce that the mean value of $\vert L(1,\chi')\vert^2$ is asymptotic to $\frac{\pi^2}{6}\prod_{q\mid d_0}\left (1-\frac{1}{q^2}\right )$, where $\chi$ runs over all odd primitive Dirichlet characters of prime conductors $p$ which are trivial on a subgroup $H$ of odd order $d\ll\frac{\log p}{\log\log p}$. As a consequence we improve the previous bounds on the relative class number of the subfield of degree $\frac{p-1}{2d}$ of the cyclotomic field ${\mathbb Q}(\zeta_p)$. Moreover, we give a method to obtain explicit formulas and use Mersenne primes to show that our restriction on $d$ is essentially sharp.


Introduction
Let X f be the multiplicative group of the φ(f ) Dirichlet characters modulo f > 2. Let X − f = {χ ∈ X f ; χ(−1) = −1} be the set of the φ(f )/2 odd Dirichlet characters modulo f . Let L(s, χ) be the Dirichlet L-function associated with χ ∈ X f . Let H denote a subgroup of index m in the multiplicative group G := (Z/f Z) * . We assume that −1 ∈ H. Hence m is even. We set X f (H) = {χ ∈ X f ; χ /H = 1}, a subgroup of order m of X f isomorphic to the group of Dirichlet characters of the abelian quotient group G/H of order m. Define X − f (H) = {χ ∈ X − f ; χ /H = 1}, a set of cardinal m/2. Let K be an abelian number field of degree m and prime conductor p ≥ 3, i.e. let K be a subfield of the cyclotomic number field Q(ζ p ) (Kronecker-Weber's theorem). The Galois group Gal(Q(ζ p )/Q) is canonically isomorphic to the multiplicative cyclic group (Z/pZ) * and H := Gal(Q(ζ p )/K) is a subgroup of (Z/pZ) * of index m and order d = (p − 1)/m. Now, assume that K is imaginary. Then d is odd, m is even, −1 ∈ H and the set X − K := X − p (H) := {χ ∈ X − p ; and χ /H = 1} is of cardinal (p − 1)/(2d) = m/2. Let K + be the maximal real subfield of K of degree m/2 fixed by the complex conjugation. The class number h K + of K + divides the class number h K of K. The relative class number of K is defined by h − K = h K /h K + . We refer the reader to [Ser] and [Was] for such basic knowledge. The mean square value of L(1, χ) as χ ranges in X − f (H) is defined by The analytic class number formula and the arithmetic-geometric mean inequality give where w K is the number of complex roots of unity in K. Hence w K = 2p for K = Q(ζ p ) and w K = 2 otherwise. In [LM21,Theorem 1.1] we proved that (3) M(p, H) = π 2 6 + o (1) as p tends to infinity uniformly over subgroups H of (Z/pZ) * of odd order d ≤ log p 3(log log p) 1 . Hence, by (2) we have (1 + o(1))p 24 In some situations it is even possible to give an explicit formula for M(p, H) implying a completely explicit bound for h − K . Indeed, by [Wal] and [Met] (see also (30)), we have Hence, . We refer the reader to [Gra] for more information about the expected size of h − Q(ζp) . The only other situation where a similar explicit result is known is the following one (see Theorem 6.6 for a new proof).
Theorem. (See 2 [Lou16, Theorem 1]). Let p ≡ 1 (mod 6) be a prime integer. Let K be the imaginary subfield of degree (p − 1)/3 of the cyclotomic number field Q(ζ p ). Let H be the subgroup of order 3 of the multiplicative group (Z/pZ) * . We have (compare with (5) and (6)) (7) M(p, H) = π 2 6 1 − 1 p ≤ π 2 6 and h − K ≤ 2 p 24 In [Lou94] (see also [Lou11]), the following simple argument allowed to improve on (6). Let d 0 > 1 be a given integer. Assume that gcd(d 0 , f ) = 1. For χ modulo f let χ ′ be the character modulo d 0 f induced by χ. Then, (throughout the paper this notation means that q runs over the distinct prime divisors of d 0 ). Let H be a subgroup of order d of the multiplicative group (Z/f Z) * , with −1 ∈ H. We define Clearly there is no restriction in assuming from now on that d 0 is square-free. Let now H be of odd order d in the multiplicative group (Z/pZ) * . Using (8), we obtain (compare with (2)): and we expect that Hence, (11) should indeed improve on (2). The aim of this paper is two-fold. Firstly, in Theorem 1.1 we give an asymptotic formula for M d 0 (p, H) when d satisfies the same restriction as in (3) allowing us to improve on the bound (4). Secondly we treat the case of groups of order 1 and 3 for small d 0 's as well as the case of Mersenne primes and groups of size ≈ log p. In both cases an explicit description of these subgroups allows us to obtain explicit formulas for M d 0 (p, H).
Our main result is the following.
Theorem 1.1. Let d 0 ≥ 1 be a given square-free integer. As p → +∞ we have the following asymptotic formula uniformly over subgroups H of (Z/pZ) * of odd order d ≤ log p 3(log log p) . Moreover, let K be an imaginary abelian number field of prime conductor p and of degree m = (p − 1)/d. Let C < 4π 2 = 39.478.. be any positive constant. If p is sufficiently large and m ≥ 3 (p−1) log log p log p , then we have . Remarks 1.2. The second result in Theorem 1.1 improves on (4), (6) and (7). It follows from the first result in Theorem 1.1, and by using (11) and (16), where we take d 0 as the product of sufficiently many consecutive first primes.
The special case d 0 = 1 was proved in [LM21,Theorem 1.1]. Note that the restriction on d cannot be extended further to the range d = O(log p) as shown by Theorem 5.2. Moreover the constant C in (13) cannot be taken larger than 4π 2 , see the discussion about Kummer's conjecture in [MP01].
In the first part of the paper, the presentation goes as follows: • In Section 2, we explain the condition about the prime divisors of d 0 and prove that • In Section 3, we review some results on Dedekind sums and prove a new bound of independent interest for Dedekind sums s(h, f ) with h being of small order modulo f (see Theorem 3.1). To do so we use techniques from uniform distribution and discrepancy theory. Then we relate M d 0 (p, H) to twisted moments of L-functions which we further express in terms of Dedekind sums. For the sake of clarity, we first treat separately the case H = {1}. Note that we found that this case is related to elementary sums of maxima that we could not estimate directly, see Section 3.4.1. Using our estimates on Dedekind sums we deduce the asymptotic formula of Theorem 1.1 and the related class number bounds. In the second part of the paper, we focus on the explicit aspects. Let us describe briefly our presentation: • In Section 4.1 we establish a formula for M d 0 (f, {1}), d 0 > 2, provided that all the prime factors q of f satisfy q ≡ ±1 (mod d 0 ). In particular, we get formulas for M d 0 (f, {1}) for d 0 ∈ {1, 2, 3, 6} and gcd(d 0 , f ) = 1 (such formulae become harder to come by as d 0 gets larger). For example, for p ≥ 5 and d 0 = 6, using Theorem 4.1 we obtain the following formula for M 6 (p, {1}): which by (11) and Corollary 2.4 give improvements on (6) (see also [Feng] and [Lou94]) . See also [Lou23,Theorem 5.2] for even better bounds. In Section 4.3 we obtain an explicit formula of the form (33) is an explicit average of Dedekind sums. In Proposition 4.6 we prove that N d 0 (p, {1}) ∈ Q depends only on p modulo d 0 and is easily computable. • For H = {1} explicit formulae for M d 0 (p, H) seem difficult to come by. In Section 5, we focus on Mersenne primes p = 2 d − 1, with d odd. We take H = {2 k ; 0 ≤ k ≤ d − 1}, a subgroup of odd order d of the multiplicative group (Z/pZ) * . For d 0 ∈ {1, 3, 15} we prove in Theorem 5.4 that where N ′ d 0 (p, H) = a 1 (p)d + a 0 (p) with a 1 (p), a 0 (p) ∈ Q depending only on p = 2 d − 1 modulo d 0 and easily computable. In the range d ≫ log p, we see that M d 0 (p, H) has a different asymptotic behavior than the one in Theorem 1.1.
• In Section 6, we turn to the specific case of subgroups of order 3. Writing f = a 2 +ab+b 2 not necessarily prime, and taking H = {1, a/b, b/a}, the subgroup of order 3 of the multiplicative group (Z/f Z) * , we prove in Proposition 6.4 that (14) for d 0 ∈ {1, 2, 3, 6}. To do so we obtain bounds for the Dedekind sums stronger than the one in Theorem 3.1. Note that this cannot be expected in general for subgroups of order 3 modulo composite f (see Remark 3.4 and 6.2). Furthermore we show that these bounds are sharp in the case of primes p = a 2 + a + 1, in accordance with Conjecture 7.1.

Preliminaries
2.1. Algebraic considerations. Take a ∈ Z with gcd(a, f ) = 1. There are infinitely many prime integers in the arithmetic progressions a + f Z. Taking a prime p ∈ a + f Z with p > d 0 f , we have s d 0 (p) = a, where s d 0 : (Z/d 0 f Z) * −→ (Z/f Z) * is the canonical morphism. Therefore, s d 0 surjective and its kernel is of order φ(d 0 ). Let H be a subgroup of (Z/f Z) * of order d. Then (1) and (9) we have The following Lemma is probably well known but we found no reference in the literature. Conversely, take g ∈ H, of order n ≥ 2 in the abelian quotient group G/H. Define a character χ of the subgroup g, H of G generated by g and H by χ(g k h) = exp(2πik/n), (k, h) ∈ Z × H. It extends to a character of G still denoted χ, by [Ser,Chapter VI,Proposition 1] , a non-empty set or cardinal m/2−m ′′ /2 = (H ′′ : H)/2 ≥ 1, then clearly χ(g) = 1, hence g ∈ ∩ χ∈X − f (H) ker χ. Therefore, Hence, by Lemma 2.1, when applying (11) we may assume that no prime divisor of d 0 is in H.

2.2.
On the size of Π d 0 (f, H) and D d 0 (f, H) defined in (10). Lemma 2.3. Let H be a subgroup of order d ≥ 1 of the multiplicative group (Z/f Z) * , where f > 2. Assume that −1 ∈ H. Let g be the order of a given prime integer q in the multiplicative quotient group (Z/f Z) * /H. Let X f (H) be the multiplicative group of the φ(f )/d Dirichlet characters modulo f for which if g is even and −q g/2 ∈ H, otherwise.
Proof. Let α be of order g in an abelian group A of order n. Let B = α be the cyclic group generated by α. LetB be the group of the g characters of B. Then P B (X) := χ∈B (X−χ(α)) = X g − 1. Now, the restriction map χ ∈Â → χ /B ∈B is surjective, by [Ser,Proposition 1], and of kernel isomorphic to A/B of order n/g, by [Ser,Proposition 2]. Therefore, P A (X) := χ∈Â (X − χ(α)) = P B (X) n/g = (X g − 1) n/g .
Let H ′ be the subgroup of order 2d generated by −1 and H. With Since q g ∈ H we have q g ∈ H ′ and g ′ divides g. Since q g ′ ∈ H ′ = {±h; h ∈ H} we have q 2g ′ ∈ H and g divides 2g ′ . Hence, g = g ′ or g = 2g ′ and g = 2g ′ if and only if g is even and The assertion follows.
Corollary 2.4. Fix d 0 > 1 square-free. Let p ≥ 3 run over the prime integers that do not divide d 0 . Let H a subgroup of odd order d of the multiplicative group (Z/pZ) * . Then, where ω(d 0 ) stands for the number of prime divisors of d 0 . In particular when d = o(log p), we have Moreover, In particular, Π 6 (p, {1}) ≥ 2/3 for p ≥ 5.
3. Dedekind sums and mean square values of L-functions 3.1. Dedekind sums and Dedekind-Rademacher sums. The Dedekind sums is the rational number defined by with the convention s(c, −1) = s(c, 1) = 0 for c ∈ Z (see [Apo] or [RG] where it is however assumed that d > 1). It depends only on c mod |d| and c → s(c, d) can therefore be seen as a mapping from (Z/|d|Z) * to Q. Notice that (make the change of variables n → nc in s(c * , d)). Recall the reciprocity law for Dedekind sums In particular, For gcd(b, c) = gcd(c, d) = gcd(d, b) = 1 we have a reciprocity law for Dedekind-Rademacher sums (see [Rad] or [BR]): The Cauchy-Schwarz inequality and (21) yield

3.2.
Non trivial bounds on Dedekind sums. In this section we will use the alternative definition of the Dedekind sums given by where (()) : R → R stands for the sawtooth function defined by In order to prove Theorem 1.1, we need general bounds on Dedekind sums depending on the multiplicative order of the argument. This is a new type of bounds for Dedekind sums and the following result that improves upon (24) when the order is o log p log log p might be of independent interest (see also Conjecture 7.1 for further discussions).
Theorem 3.1. Let p > 1 be a prime integer and assume that h has odd order k ≥ 3 in the multiplicative group (Z/pZ) * . We have Remarks 3.2. Let us notice that by a result of Vardi [Var], for any function f such that However Dedekind sums take also very large values (see for instance [CEK,Gir03] for more information).
Our proof builds from ideas of the proof of [LM21,Theorem 4.1] where some tools from equidistribution theory and the theory of pseudo-random generators were used. We refer for more information to [Kor], [Nied77] or the book of Konyagin and Shparlinski [KS,Chapter 12] (see [LM21,Section 4] for more details and references). Let us recall some notations. For any fixed integer s, we consider the s-dimensional cube I s = [0, 1] s equipped with its s-dimensional Lebesgue measure λ s . We denote by B the set of rectangular boxes of the form Let us introduce the following set of points: For good choice of h, the points are equidistributed and we expect for "nice" functions f Lemma 3.3. For any h of odd order k ≥ 3 we have the following discrepancy bound Proof. It follows from the proof of [LM21,Theorem 4.1] where the bound was obtained as a consequence of Erdős-Turan inequality and tools from pseudo random generators theory.
3.2.1. Proof of Theorem 3.1. Observe that y)). By Koksma-Hlawka inequality [DT,Theorem 1.14] we have where V (f ) is the Hardy-Krause variation of f . Moreover we have The readers can easily convince themselves that V (f ) ≪ 1. Hence the result follows from Lemma 3.3.
Remarks 3.4. The same method used to bound the discrepancy leads to a similar bound for which is close to the truth by a logarithmic factor (see Remark 6.2). A similar argument as in the proof of Theorem 3.1 leads to a bound on these generalized sums: Theorem 3.5. Let q 1 , q 2 and k ≥ 3 be given natural integers. Let p run over the primes and h over the elements of order k in the multiplicative group (Z/pZ) * . Then, we have Proof. The proof follows exactly the same lines as the proof of Theorem 3.1 except for the fact that the function f is replaced by the function g(x, y) = ((q 1 x))((q 2 y)). Hence we have and by symmetry we remark that Again V (g) ≪ 1 and the result follows from Lemma 3.3 and Koksma-Hlawka inequality.
3.3. Twisted second moment of Lfunctions and Dedekind sums. We illustrate the link between Dedekind sums and twisted moments of L-functions by first proving Theorem 1.1 in the case H = {1} with a stronger error term. For any integers q 1 , q 2 ≥ 1 and any prime p ≥ 3, we define the twisted moment The following formula (see [Lou94,Proposition 1]) will help us to relate L-functions to Dedekind sums: Theorem 3.6. Let q 1 and q 2 be given coprime integers. Then when p goes to infinity Remarks 3.7. It is worth to notice that in the case q 2 = 1, explicit formulas are known by [Lou15,Theorem 4] (see also [Lee17]). This also gives a new and simpler proof of [Lee19, Theorem 1.1] in a special case.
Proof. Let us define For p large enough, we have gcd(q 1 , p) = gcd(q 2 , p) = 1. Hnece, using orthogonality relations and (26) we arrive at When q 1 and q 2 are fixed coprime integers and p goes to infinity, we infer from (23) and (24) that The result follows immediatly.
The proof of Theorem 1.1 in the case of the trivial subgroup follows easily.
Corollary 3.9. Let d 0 be a given square-free integer. When p goes to infinity, we have the following asymptotic formula Proof. For χ modulo p, let χ ′ be the character modulo d 0 p induced by χ. By (8) and Corollary 3.8 we have 3.4. An interesting link with sums of maxima. Before turning to the general case of Theorem 1.1, we explain how to use Theorem 3.6 to estimate the seemingly innocuous sum 4 defined for any integers q 1 , q 2 ≥ 1 by where here and below q 1 x, q 2 x denote the representatives modulo p taken in [1, p].
Theorem 3.10. Let q 1 and q 2 be natural integers such that q 1 = q 2 . Then we have the following asymptotic formula (1)).
Remarks 3.11. In the special case q 1 = 1, we are able to evaluate the sum directly without the need of Dedekind sums and L-functions. However, we could not prove Theorem 3.10 in the general case using elementary counting methods.
Remarks 3.12. Let us notice that 1 0 1 0 max(x, y)dxdy = 2/3. Hence using the same method as in Section 3.2, we can show that if the points x p , qx p are equidistributed in the square For q fixed and p → +∞, the points are not equidistributed in the square and we see that the correcting factor gcd(q 1 ,q 2 ) 2 12q 1 q 2 from equidistribution is related to the Dedekind sum s(q 1 , q 2 , p).
We need the following result of [LM21, Theorem 2.1]: Proposition 3.13. Let χ be a primitive Dirichlet character modulo f > 2, its conductor. Set Adding the contribution of the trivial character For sufficiently large p, using the fact that q 1 = q 2 mod p and the orthogonality relations, we have χ∈Xp χ(q 1 )χ(q 2 ) p 2 − 1 12 = 0.
We now follow the method used in the proof of [LM21,Theorem 4.1] (see also [Elma]) with some needed changes to treat the left hand side of (27). Again by orthogonality, we obtain Changing the order of summation and making the change of variables n 1 = q 2 m 1 we arrive at By symmetry, injecting this into (27), we arrive at Hence comparing the terms of order p 3 in the above formula (28) and using Corollary 3.8, we have This concludes the proof.
We know turn to the general case of Theorem 1.1. Let d 0 be a given square-free integer such that gcd(d 0 , p) = 1. For χ modulo p, let χ ′ be the character modulo d 0 p induced by χ. Recall that we want to show for H a subgroup of (Z/pZ) * of odd order d ≪ log p log log p that 3.5. Twisted average of Lfunctions over subgroups. For any integers q 1 , q 2 ≥ 1 and any prime p ≥ 3, we define Our main result is the following: Theorem 3.14. Let q 1 and q 2 be given coprime integers. When H runs over the subgroups of (Z/pZ) * of odd order d, we have the following asymptotic formula .
Proof. The proof follows the same lines as the proof of Theorem 3.6. Let us define if p ∤ ab and a ∈ bH, −1 if p ∤ ab and a ∈ −bH, 0 otherwise.
Hence we obtain similarly where we used Theorem 3.5 in the last line and noticed that φ(k) divides φ(d) whenever k divides d.
Remarks 3.15. The error term is negligible as soon as d ≤ log p 3(log log p) .
Corollary 3.16. Let q 1 and q 2 be given integers. When H runs over the subgroups of (Z/pZ) * of odd order d, we have the following asymptotic formula M q 1 ,q 2 (p, H) = π 2 6 gcd(q 1 , q 2 ) 2 q 1 q 2 .
3.6. Proof of Theorem 1.1. As in the proof of Corollary 3.9 and using Corollary 3.16 using the condition on d.

Explicit formulas for M d 0 (f, H)
Recall that by (26) Hence using the definition of Dedekind sums we obtain (see [Lou16, Proof of Theorem 2])

4.1.
A formula for M d 0 (f, {1}) for d 0 = 1, 2, 3, 6. The first consequence of (29) is a short proof of [Lou94, Théorèmes 2 and 3] by taking H = {1}, the trivial subgroup of the multiplicative group (Z/f Z * ). Indeed, (29) and (21) give The arithmetic functions f → δ|f µ(δ)δ k being multiplicative, we obtain (see also [Qi]) Now, it is clear by (15) that for d 0 odd and square-free and f odd we have Hence, on applying (30) to 2f instead of f we therefore obtain For d 0 ∈ {3, 6}, the following explicit formula holds true for any f coprime with d 0 . It generalizes [Lou94, Théorème 4] to composite moduli Theorem 4.1. Let d 0 > 2 be a given square-free integer. Set . Then for f > 2 such that all its prime divisors q satisfy q ≡ ±1 (mod d 0 ) we have In particular, for f > 2 such that all its prime divisors q satisfy q ≡ 1 (mod d 0 ) we have Hence we finally get The desired formula for M d 0 (f, {1}) follows by using the explicit formula given in [Lou11, Lemma 6]. (29) and (21)

4.3.
A formula for M d 0 (p, H). We will now derive a third consequence of (29): a formula for the mean square value M d 0 (f, H) defined in (9) when f is prime.

4.3.1.
A new proof of Theorem 1.1. We split the sum in (39) into two cases depending whether h = 1 or not. By (21) we have s(1, δp) = pδ 12 + O(1) giving a contribution to the sum of order When h = 1 and h ∈ H d 0 , it is clear that the order of h modulo p is between 3 and d. Hence it follows from Theorem 3.1 (see the Remark after) that s(h, δp) = O((log p) 2 p 1− 1 φ(d) ). The integer d 0 being fixed, we can sum up these error terms and the proof is finished.

An explicit way to compute
Proof. As in [Lou11,Lemma ], set where F (x, y) = 1 + cot(πx) cot(πy). On the one hand, since gcd(d 0 f, n) = 1 if and only if gcd(d 0 , n) = gcd(f, n) = 1 and d|f d|n µ(d) is equal to 1 if gcd(f, n) = 1 and is equal to 0 otherwise, we have On the other hand, the canonical morphism σ : . Hence σ is bijective and Using [Lou11,Lemma 6] and Möbius' inversion formula, we finally do obtain where we set δ ′ = d/δ.
Remarks 4.7. As a consequence we obtain M d 0 (p, {1}) = π 2 6 q|d 0 1 − 1 q 2 + O(p −1 ), using (35) and the fact that N d 0 (p, {1}) depends only on p modulo d 0 . This gives in this extreme situation another proof of Theorem 1.1 with a better error term. Moreover, in that situation we have K = Q(ζ p ) and in (11) the term Π d 0 (p, {1}) is bounded from below by a constant independent of p, by Corollary 2.4.

5.
The case where f = a d−1 + · · · + a 2 + a + 1 In this specific case we are able to obtain explicit formulas for M d 0 (f, H) when the subgroup H is defined in terms of the parameter a defining the modulus. For a general subgroup H, it seems unrealistic to be more explicit than the formula involving Dedekind sums given in Theorem 4.4. It might be interesting to explore formulas involving continued fraction expansions in view of their link to Dedekind sums [Hic]. 5.1. Explicit formulas for d 0 = 1, 2.
Lemma 5.1. Let f > 1 be a rational integer of the form f = (a d − 1)/(a − 1) for some a = −1, 0, 1 and some odd integer d ≥ 3. Hence f is odd. Set H = {a k ; 0 ≤ k ≤ d − 1}, a subgroup of order d of the multiplicative group (Z/f Z) * . Then, if a is even.
if a is even.
Noticing that d−1 k=1 a k = f − 1 and d−1 k=1 a −k = f −1 (a−1)f +1 , we then get the assertions on S(H, f ) and S(H 2 , 2f ). Now, let us for example prove the third claim. Hence, assume that a is even and that 1 ≤ k ≤ d − 1. Then f k := (a k − 1)/(a − 1) is odd, sign(f k ) = sign(a) k and a k + f > 0. First, since 2f ≡ −2a k (mod a k + f ), using (20) we have Second, noticing that a k + f ≡ f k (mod 2a k ) and using (20) we have Finally, noticing that 2a k ≡ 2 (mod f k ) and using (20) and (21) we have After some simplifications, we obtain the desired formula for s(a k + f, 2f ). Notice that for d = 3 we obtain S(H, f ) = f −1 12 , in accordance with (51).
Using (34) and Lemma 5.1 we readily obtain: Theorem 5.2. Let d ≥ 3 be a prime integer. Let p ≡ 1 (mod 2d) be a prime integer of the form p = (a d − 1)/(a − 1) for some a = −1, 0, 1. Let K be the imaginary subfield of degree (p − 1)/d of the cyclotomic field Q(ζ p ). Set H = {a k ; 0 ≤ k ≤ d − 1}, a subgroup of order d of the multiplicative group (Z/pZ) * . We have the mean square value formulas Consequently, for a given d, as p → ∞ we have On the other hand, for a given a, as p → ∞ we have if a is even.

5.2.
The case where p is a Mersenne prime and d 0 = 1, 3, 15. In the setting of Theorem 5.4, we have 2 ∈ H. Hence, by Remark 2.2 we assume that d 0 is odd.
where for H a subgroup of odd order of the multiplicative group (Z/f Z) * we set The formulas for M(p, H), M 3 (p, H) and M 15 (p, H) follow from (45) and Lemma 5.5 below.
where A 1 (d) and A 0 (d) are rational numbers which depend only on d modulo N, i.e. only on f modulo d 0 . Hence for a prime p ≥ 3 we expect confirming again that the restriction on d in Theorem 1.1 should be sharp.
There is apparently no theoretical obstruction preventing us to prove Conjecture 5.7. Indeed, for a fixed d 0 , the formulas for A 0 (d) and A 1 (d) could be guessed using numerous examples on a computer algebra system. However for large d 0 's the set of cases to consider grows linearly and a more unified approach seems to be required to give a complete proof.
Remarks 6.2. Take f 1 = A 2 + AB + B 2 > 0, where 3 ∤ f 1 and gcd(A, B) = 1. Set f = (f 1 + 1) 3 − 1. Then f = a 2 + ab + b 2 , where a = Af 1 + A − B, b = Bf 1 + A + 2B and gcd(a, b) = 1. By Lemmas 6.1 we have an infinite family of moduli f for which the multiplicative group (Z/f Z) * contains at the same time an element h = a/b of order d = 3 for which s(h, f ) is asymptotic to 1/12 and an element h ′ = f 1 + 1 of order d = 3 for which s(h ′ , f ) is asymptotic to f 2/3 /12. Indeed by (20) and (21) for To deal with the case d 0 > 1, we notice that by (37) we have: Proposition 6.3. Let d 0 ≥ 1 be a given squarefree integer. Take f > 3 odd of the form f = a 2 + ab + b 2 , where gcd(a, b) = 1 and gcd(d 0 , f ) = 1. Set H = {1, a/b, b/a}, a subgroup of order 3 of the multiplicative group (Z/f Z) * . Let N d 0 (f, H) be the rational number defined in (33). Then {1}) is a rational number which depends only on f modulo d 0 , by Proposition 4.6, and where S(a, b, δf ) = It seems that there are no explicit formulas for S(a, b, δf ), S(H δ , δf ) or N δ (f, H) for δ > 1 (however, assuming that b = 1 we will obtain such formulas in Section 6.2 for δ ∈ {2, 3, 6}). Instead, our aim is to prove in Proposition 6.4 that N δ (f, H) = O( √ f ) for δ ∈ {2, 3, 6}. Let f > 3 be of the form f = a 2 + ab + b 2 , with a, b ∈ Z and gcd(a, b) = 1. Hence, a or b is odd. Since a 2 + ab , we may assume that both a and b are odd. Moreover, assume that gcd(3, f ) = 1. If 3 ∤ ab, by swapping a and b as needed, which does not change neither H nor S(a, b, H), we may assume that a ≡ −1 (mod 6) and b ≡ 1 (mod 6). If 3 | ab, by swapping a and b and then changing both a and b to their opposites as needed, which does not change neither H nor S(a, b, H), we may assume that a ≡ 3 (mod 6) and b ≡ 1 (mod 6). So in Proposition 6.3 we may restrict ourselves to the integers of the form (52) f > 3 is odd of the form f = a 2 + ab + b 2 , with a, b ∈ Z odd and gcd(a, b) = 1 and if gcd(3, f ) = 1 then a ≡ −1 or 3 (mod 6) and b ≡ 1 (mod 6).

Conclusion and a conjecture
The proof of Lemma 5.1 gives for d ≥ 3 odd and a = 0, ±1 Our numerical computations suggest the following stronger version of Theorem 3.1: Conjecture 7.1. There exists C > 0 such that for any odd d > 1 dividing p − 1 and any h of order d in the multiplicative group (Z/pZ) * we have (67) |s(h, p)| ≤ Cp 1− 1 φ(d) .
Indeed, for p ≤ 10 6 we checked on a desk computer that any odd d > 1 dividing p − 1 and any h of order d in the multiplicative group (Z/pZ) * we have Q(h, p) := |s(h, p)| ≤ Q(2, 2 7 − 1) = 0.08903 · · · The estimate (67) would allow to slightly extend the range of validity of Theorem 1.1 to d ≤ (1 − ε) log p log log p . Moreover the choice a = 2 in (66) for which s(2, f ) is asymptotic to 1 24 f with f = 2 d − 1 shows that s(h, p) = o(p) cannot hold true in the range d ≍ log p. Notice that we cannot expect a better bound than (67), by (66). Finally, the restriction that p be prime in (67) is paramount by Remark 6.2 where s(a, f ) ∼ f 2/3 /12 for a of order 3 in (Z/(a 3 − 1)Z) * .