arXiv:1509.04323v2 [math.NT] 19 Jun 2016 L0] fpeetn h ebr rc oml o ek operator Hecke for formula trace Selberg the presenting of [Li05]) qiaett ebr’ ievlecnetr o Γ for conjecture eigenvalue Selberg’s to equivalent wssb h udai hrce (mod character quadratic the by twists N ssmlri a ic tivle nyasnl iihe eis oee,o level However, to series. 1 level Dirichlet fac from single in passage a and the only [Li08], that involves in fact it Li the since by plain way given makes a was criterion in similar simpler A is 1. level for formula rvdn ute upr o h nlg ewe xetoa e exceptional between analogy the for support further providing ohatoswr upre yESCGrants EPSRC by supported were authors Both nti ae,w xlr h dao oryadL C0](ae gen (later [CL01] Li and Conrey of idea the explore we paper, this In epeettoapiain forfrua is,frprime for First, formula. our of applications two present We qaere saDrcltsre.W nac hi oki e way few a in work their enhance We series. Dirichlet a as squarefree, • • • • • H EBR RC OML SADRCLTSERIES DIRICHLET A AS FORMULA TRACE SELBERG THE Abstract. ocsia as efrso qaerelevel squarefree of newforms Maass cuspidal to o naiheial egtdsmo h opeesmercsquare symmetric complete Dirich the certain of of sum interpret weighted twists arithmetically an quadratic an including of for applications, terms two in describe conjecture We eigenvalue series. Dirichlet a epoetemrmrhccniuto fterlvn iihe ser Dirichlet relevant the of continuation meromorphic the prove We imn eafnto) atwihsest aebe overlook relat been have turn to in c seems are fin obtain which (which the we fact determinant in series a scattering errors zeta-function), Dirichlet the for Riemann the of potential zeros that the the shows limit at formula helps our this instance, and For robust, s two highly the is Th comparing it by principles. vetted first from been b term has published Str¨ombergsson’s each formula formula out trace working the than of applications. rather version [Str16], for a on useful calculations is our that base We result simpler a to < n etetteHceoperators Hecke the dividing treat levels We of newforms for formulas r could it. one estima that from by sense formula For any the trace in replacing the generality, derive without of to loss terms, no all entails formula for our formulas explicit give We oso eeaiy ic n a eoe h ulfruafrlevel for formula full the again recover though can formula, one cleaner since significantly generality, a of is loss result The spectrum. cmae with (compared > N .When 0. ecmuetetaeoe the over trace the compute we 1 eepoea dao oryadL fepesn h ebr trace Selberg the expressing of Li and Conrey of idea an explore We < n ℜ ( ,teeaen litctrsi h rc oml,adti leads this and formula, trace the in terms elliptic no are there 0, s ) NRWR OKRADMNLEE MIN AND BOOKER R. ANDREW > n[CL01]). in 0 1. T n Introduction N o l non-zero all for ftefml fDrcltsre rsn rmour from arising series Dirichlet of family the of ) EP/H005188/1 1 > N N newforms 0 . ( N 1. ,i em fteaayi rprisof properties analytic the of terms in ), n , EP/L001454/1 opiet h level the to co-prime N flevel of sesnilyaqartctwist, quadratic a essentially is e eis n formula a and series, let gnausadSee zeros. Siegel and igenvalues N L cigon acting s fntosassociated -functions N edrv statement a derive we , to fteSelberg the of ation ahrta h whole the than rather and s: dsnmrcly so numerically, ides N datg sthat is advantage e di [CL01]. in ed dt eo fthe of zeros to ed isformulation Li’s t EP/K034383/1 rlzdb iin Li by eralized Str¨ombergssony ysmigthe summing by oml as formula vreteproof the everse e oall to ies rformulation ur hsetisno entails this L nhv poles have an 2 N (Γ lformula. al e.Thus, tes. including , 0 ( N s ) . \ ∈ H C ), Second, for squarefree N > 1, we sum our formula for T n2 acting on Γ0(N) H to obtain an ǫ 2 − \ explicit expression for ∞ ( 1) j L∗(s, Sym f ), where f ∞ is a complete, arithmetically j=1 − j { j}j=1 normalized sequence of Hecke–Maass newforms on Γ0(N) H, ǫj 0, 1 is the parity of 2 P \ ∈ { } fj, and L∗(s, Sym fj) is the complete symmetric square L-function. When N = 2, the 1 answer can be interpreted as the Rankin–Selberg convolution of the weight 2 harmonic weak Maass form defined in [RW11] with a weight 1 Eisenstein series, much like Shimura’s integral representation for the symmetric square L-function. Similar formulas have been derived for averages of L-functions over an L2-normalized basis (see, e.g., [Mot92]); to our knowledge, ours is the first such to be derived from the Selberg trace formula, with arithmetic normalization. 1.1. Notation and statement of main results. Let denote the set of discriminants, that is D = D Z : D 0 or 1(mod 4) . D { ∈ ≡ } Any non-zero D may be expressed uniquely in the form dℓ2, where d is a fundamental ∈D d discriminant and ℓ > 0. We define ψD(n) = n/ gcd(n,ℓ) , where denotes the Kronecker symbol. Note that ψD is periodic modulo D, and if D is fundamental  then ψD is the usual quadratic character mod D. Set

∞ ψ (n) L(s, ψ )= D for (s) > 1. D ns ℜ n=1 X Then it is not hard to see that

ordp(ℓ) js L(s, ψ )= L(s, ψ ) 1+ 1 ψ (p) p− , D d − d p ℓ " j=1 # Y|  X so that L(s, ψD) has analytic continuation to C, apart from a simple pole at s = 1 when D is a square. In particular, if D is not a square then we have

1 (ℓ,p∞) 1 (1.1) L(1, ψ )= L(1, ψ ) 1+ p ψ (p) − . D d · ℓ − d p 1 p ℓ  −  Y|  Our first result is the following: Theorem 1.1. (1) For any positive integer n, the series

L(1, ψ 2 ) (1.2) t +4n (t2 +4n)s t Z √t2X+4∈ n/Z ∈ has meromorphic continuation to C and is holomorphic for (s) > 0, apart from a 1 ℜ simple pole of residue σ 1(n) at s = 2 . − 4n (2) If n is a positive integer and N is a prime such that − = 1, then the series N − t2+4n  L(1, ψt2+4n) N (1.3) (t2 +4n)s  t Z √t2X+4∈ n/Z ∈ 2 has meromorphic continuation to C and is holomorphic for (s) > 7 . ℜ 64 (3) For any prime N, the Selberg eigenvalue conjecture is true for Γ0(N) if and only if 4n (1.3) is holomorphic on (s) > 0 for all primes n satisfying − = 1. ℜ N − Remarks.  (1) The locations and residues of the poles of (1.2) and (1.3) are related to the trace of 2 2 T n over the discrete spectrum of the Laplacian on L (Γ0(1) H) and L (Γ0(N) H), respectively.− See Propositions 3.1 and 3.2 for full details. \ \ (2) A simple consequence of (1) is the asymptotic

L(1, ψt2+4n) σ 1(n)X as X . ∼ − →∞ t Z [1,X] ∈ ∩ √t2X+4n/Z ∈ In fact, arguing as in the proof of Theorem 1.3 below, one can see that the two sides 3 +ε are equal up to an error of On,ε X 5 . Related averages over discriminants of the form t2k 4 for fixed k were computed by Sarnak [Sar85] and subsequently generalized  by Raulf− [Rau09], who obtained averages over arithmetic progressions and also sieved to reach the fundamental discriminants. It would be interesting to see whether our formula for the generating function could be used in conjunction with Raulf’s work to obtain sharper error terms. (See also Hashimoto’s recent improvement [Has13] of [Sar82] and [Rau09] for the closely related problem of determining the average size of the class number over discriminants ordered by their units.)

Next, we define more general versions of the coefficients L(1, ψD) that will turn out to be related to the newforms of a given squarefree level N > 1. For non-zero D = dℓ2 , let ∈ D m =(N ∞,ℓ), and define

1 m− p N (ψD/m2 (p) 1) L(1, ψD/m2 ) if d =1, (1.4) cN (D)= | 1 2N − · 6 Λ(N) m− if d =1, ( Q − N+1 where Λ denotes the von Mangoldt function. For notational convenience, we set cN (D)=0 when D 2 or 3(mod 4). When ≡N = 2, it was shown in [RW11] that the numbers c (n) if n 0, 1(mod 4), c+(n)= 2 ≡ 2c (4n) if n 2, 3(mod 4), ( 2 ≡ 1 for n> 0, are the Fourier coefficients of a weight 2 mock modular form for Γ0(4) with shadow 3 n2 1 Θ , where Θ = n Z q is the classical theta function. Now, for a positive∈ integer n, put P 1 2 2 2 πn r(n)= # (x, y) Z : n = x +4y = 1 + cos ψ 4(d). 2 ∈ 2 − d n   X| 1Our definition of c+(n) differs from that in [RW11] in a few minor ways. First, we have scaled their π + definition by the constant 6 . Second, there is a mistake in the formula for c (n) given in [RW11] for square values of n, to the effect that their formula should be multiplied by 2 2− ord2(n)/2. Third, the mock modular form is only determined modulo CΘ from its defining properties; we− add a particular multiple of Θ to make Theorem 1.2 as symmetric as possible. 3 1 The factor 2 is chosen to make r multiplicative; in fact, we have

∞ r(n) s 1 2s = (1 2− +2 − )ζ(s)L(s, ψ 4), ns − − n=1 X so that r(n) are the Fourier coefficients of a modular form of weight 1 and level 16.

Theorem 1.2. Let N > 1 be a squarefree integer, and let f ∞ be a complete sequence { j}j=1 of arithmetically normalized Hecke–Maass newforms on Γ0(N) H, with parities ǫj 0, 1 , 1 2 \ ∈{ } Laplace eigenvalues 4 + rj and Hecke eigenvalues λj(n). Define

s s s/2 s Γ (s)= π− 2 Γ , ζ∗(s)=Γ (s)ζ(s), E∗ (s)= N (1 p− ), ζ∗ (s)= E∗ (s)ζ∗(s), R 2 R N − N N p N  Y| ∞ 2 2 ΓR(s)ΓR(s 2irj)ΓR(s +2irj) λj(n ) L∗(s, Sym f )= − ζ∗ (2s) , j Γ (2s) N ns R n=1 X 1 EN∗ (s)EN∗ (1 s) N (s; σ)= − EN∗ (2u)ζ∗(s u)ζ∗(s + u) du, I 2πi (u)= σ EN∗ (u)EN∗ (1 u) − Zℜ − − and

∞ cN (n)r(n) F (s)= ζ∗ (4s)Γ (2s) . N N R ns n=1 X Then, for any σ > 2 and s C with (2s) (2, σ), we have ∈ ℜ ∈ ∞ ǫ 2 F (s)= ( 1) j L∗(2s, Sym f ) N − j j=1 X NΛ(N) + ζ∗(2s) √Nζ∗ (2s 1)ζ∗ ( 2s) ζ∗ (4s)+ ζ∗ (2 4s)+ (2s; σ) . N − N − − N+1 N N − IN   In particular, FN (s) continues to an entire function, apart from at most simple poles at s 1 , 0, 1 , 1 , and is symmetric with respect to s 1 s. ∈ {− 2 2 } 7→ 2 − An analogue of Theorem 1.2 holds for N = 1 as well, but the result is more complicated to state. We content ourselves with the following consequence. Theorem 1.3. As X , for any ε> 0, →∞ 15ζ(3) 8 +ε L(1, ψ )r(D)= X + O X 11 . D 4π 0

Acknowledgements. We thank Dorian Goldfeld and Peter Sarnak for helpful suggestions and corrections. 4 2. The Selberg trace formula

Let N be a squarefree positive integer, and for any λ R 0, let (N,λ) denote the space ∈ ≥ A of automorphic forms f L2(Γ (N) H) satisfying y2 ∂2 + ∂2 + λ f = 0. We begin ∈ 0 \ ∂x2 ∂y2 with the trace formula for level 1.    Proposition 2.1. Let n be a non-zero integer and q : [0, ) C a smooth function satis- 1 δ ∞ → fying q(v) (1 + v)− 2 − for some δ > 0. Define ≪ y2 + 2(n n ) f(y)= q −| | , 4 n  | |  2 u iru ir ∞ n 2ir 1 h(r)= q sinh e du =2 n − f v v − dv 2 | | − v ZR Z0    for r C with (r) < 1 + δ, ∈ |ℑ | 2

√ D f(y) | | L(1, ψD) π R y2+ D dy if D< 0, √ | | √ L(1, ψD)f DR if D> 0, D / Z, W (D)= f(y) ∈  1 √ ∞ √  m √D Λ(m)(1 m− )f( D)+ √D √ dy if 0 = D Z,  | − y+ D 6 ∈ 1 f(y)+f(y−1 ) f(0) 1 f(0) f(y) ∞ − ∞ − if (Pγ log 2)f(0) + 2 0 y R dy + 3 0 y2 dy D =0  −  for D , and R R ∈D n n ∞ Λ(m) n ∞ f(v ) f(a ) F (a)=2 f am +2a − v − − a dv m − am v2 a2 m=1 a (2.1) X   Z − n h(0) + γ + log(4π) f a − a − 4   for a Z with a n. Then  ∈ >0 | 1 2 Tr Tn (1,λ)h λ = F (a)+ W (t 4n) (2.2) |A − 4 − λ R≥0 a Z>0 t Z X∈ q  X∈a n X∈ | and

1 σ2ir( n ) φ′ 1 σ0( n ) (2.3) F (a)= h(r) |ir | + ir dr + | | h(0), 4π R n φ 2 4 a Z>0 Z | |   X∈a n | ζ∗(2(1 s)) − where φ(s)= ζ∗(2s) . Proof. We first derive (2.3). For a sufficiently nice, even pair g, h, it was shown in [Hej83, p. 509] that

1 φ 1 1 h(0) ∞ Λ(m) h(r) ′ + ir dr = g(0) log π h(r)ψ 1 +ir dr +2 g(2 log m). 4π φ 2 −2π 2 − 2 m ZR   ZR m=1 5  X a a ir Replacing g(u) by ad=n g u log d and h(r) by h(r) ad=n d , we get a>0 − a>0  P P 1 σ ( n ) φ′ 1 σ ( n ) h(r) 2ir | | + ir dr + 0 | | h(0) 4π n ir φ 2 4 ZR | |   ir a 1 a 1 = g log log π h(r) ψ 2 + ir dr (2.4) " d − 2π R d ad=n   Z Xa>0 

h(0) ∞ Λ(m) a +2 g log 2 log m . − 4 m d − # m=1   X

Similarly, from the identity

1 ∞ 1 γ ∞ g(u) g(0) h(r)ψ 2 + ir dr = g(0) log 4e + − du −2π 0 2 sinh(u/2) Z−∞ Z  

we derive

1 ∞ a ir h(r) ψ 1 + ir dr − 2π d 2 ad=n Z−∞ Xa>0  a a a ∞ g u + log g log = g log log 4eγ + d − d du , " d 0 2 sinh(u/2) # ad=n   Z   Xa>0 

so that

1 σ ( n ) φ′ 1 σ ( n ) h(r) 2ir | | + ir dr + 0 | | h(0) 4π n ir φ 2 4 ZR | |   a a a ∞ g u + log g log = g log log 4πeγ + d − d du " d 0 2 sinh(u/2) ad=n   Z   Xa>0 

h(0) ∞ Λ(m) a +2 g log 2 log m . − 4 m d − # m=1   X

2 u u u a 2 2 Now let g(u) = q(sinh ( 2 )). Then g u + log d = f ae de− , so on making the u/2 − substitution v = ae , we get ad=n F (a), as required. a>0   6 P Turning to (2.2), in [Str16, 2.1] we find the following trace formula for level 1: (2.5) § 1 Tr Tn (1,λ)h λ |A − 4 λ R X∈ ≥0 q  + = h (r[c]) r[1]× : r[c]× A(t, n) t Z  c ℓ  √t2X∈4n/Z X|   − ∈ 1 r tanh(πr)h(r) dr + g(0) log π√n + h(0) 1 h(r)ψ(1 + ir) dr if √n Z, + 12√n R 2 4 − 2π R ∈ (0 R R otherwise n n a2 + log π + log a X a g log − a − − a n a Z>0 (   a n,X∈ a2=n h  i | 6 u u 1 ∞ e 2 + sgn(n)e 2 + g(u) − du 2 log a u u a √ n ) Z √|n| e 2 sgn(n)e− 2 + sgn(n) | | √ n a − | | − 2 2 ir ∞ Λ( m) a h (0) 1 ∞ a + 2 g log 2 log m h(r) ψ 1 + ir dr , m n − − 4 − 2π n 2 a Z>0 m=1   Z−∞  X∈a n X  | where the notation is as follows: t2 4n = dℓ2, where d is a fundamental discriminant and ℓ> 0; • r − d+√d √ r [c]= Z + Zc 2 is the quadratic order of conductor c in Q( d) and [c]× is its unit • group; h+(r[1])c Q (1 ψ (p)p−1) + r p|c − d r h ( [c]) = [r[1]×:r[c]×] is the narrow class number of [c]; • + r ǫd > 1 is the smallest unit in [1]× with norm 1 (i.e. the fundamental unit when it • has norm 1 and its square otherwise); + log ǫ t +√t2 4n 2 d g 2 log | | − if t 4n> 0, √t2 4n 2√ n A(t, n)= − | | − •   −2r arccos(|t|/2√|n|) 2 e h(r) dr if t2 4n< 0;  r[1]× √4n t2 R 1+e−2πr | | − − 1 Λ(m) X(u)= u m (mod u) logR gcd(m, u)= m u m . •  | Writing D = t2 4n = dℓ2, we have P− P + h (r[c]) r[1]× : r[c]× A(t, n)

h+(r[1]) log ǫ+ t +√D   d g 2 log | | if D > 0, c ψd(p) √d 2√ n = 1 | | +   ℓ − p  2h (r[1]) e−2r arccos(|t|/2√|n|) p c    −2πr h(r) dr if D < 0. |  r[1]× √ d R 1+e Y | | | | R By Dirichlet’s class number formula, we have h+(r[1]) log ǫ+ d if d> 0, √d L(1, ψ )= h+ r d  2π ( [1]) if d< 0,  r[1]× √ d | 7| | |  so this becomes

t +√D 2 c ψ (p) g 2 log | | if t 4n> 0, d 2√ n L(1, ψd) 1 | | − ℓ − p   −2r arccos(|t|/2√|n|) p c   1 e h(r) dr if t2 4n< 0. Y|  π R 1+e−2πr − Summing over c and using (1.1), we findR by a short computation that c ψ (p) (2.6) L(1, ψ ) 1 d = L(1, ψ ). d ℓ − p D c ℓ p c   X| Y| n u Further, we have g(u)= f v , where v = n e 2 . Hence − v | |  t + √Dp g 2 log | | = f √D . 2 n ! | |  −2 arccos(|t|/2√|n|)r Next we evaluate the integral 1 e p h(r) dr. It occurs only when D = t2 π R 1+e−2πr − 4n< 0, so we may assume that n is positive. Writing α = arccos( t /2√n), we have R | | 1 e 2αr 1 e(π 2α)r 1 e(π 2α)r − h(r) dr = − h(r) dr = − g(u)eiru dudr π 1+ e 2πr 2π cosh(πr) 2π cosh(πr) ZR − ZR ZR ZR 1 eir(u+i[2α π])r 1 g(u) = g(u) − dr du = du 2π cosh(πr) 2π cosh( u + i[α π ]) ZR ZR ZR 2 − 2 1 g(u) = du 2π cosh( u ) sin α i sinh( u ) cos α ZR 2 − 2 1 cosh( u ) sin α + i sinh( u ) cos α 1 g(u) cosh( u ) sin α = g(u) 2 2 du = 2 du, 2π sinh2( u ) + sin2 α 2π sinh2( u ) + sin2 α ZR 2 ZR 2 2 u where in the last line we make use of the fact that g is even. Writing g(u) = q sinh ( 2 ) and making the substitution y =2√n sinh u , this becomes simply 2  D y2 dy D f(y) | | q = | | dy. π 4n y2 + D π y2 + D p ZR   | | p ZR | | Hence, altogether we have f √D if D> 0, + r r r (2.7) h ( [c]) [1]× : [c]× A(t, n)= L(1, ψD) √ D | | dy c ℓ ( π R f(y) y2+ D if D< 0. X|   | | R u u Next, in the penultimate line of (2.5), we write y = n e 2 (sgn n)e− 2 , so that g(u)= f(y) and | | − p  u u 1 ∞ e 2 + sgn(n)e 2 ∞ f(y) (2.8) g(u) − du = dy, 2 log a u u a √ n ℓ ℓ + y Z √|n| e 2 sgn(n)e− 2 + sgn(n) | | Z − √ n − a | | 2 where ℓ = a n/a , This term contributes whenever a = n, and those a are in one-to- one correspondence| − | with the non-zero square values D =6 ℓ2 in (2.2). Similarly, we get a 8 contribution of 2 a 1 (2.9) log π + log ℓ X(ℓ) g log = log π + Λ(m) 1 m− f(ℓ) − n −   m ℓ !   X|  when D = ℓ2 = 0. As for the final line of (2.5), by (2.4) and (2.3), it is 6 a2 n F (a) g log log π = F (a) f a log π , − n − − a 0 0, we∈ have π√n h(0) 1 g(0) log + h(r)ψ(1 + ir) dr 2 4 − 2π R γ Z πe √n ∞ = g(0) log + log(2 sinh(u/2))g′(u) du 2 0 γ Z c πe √n c g(u) g(0) ∞ g(u) = g(0) log + g(0) log 2 sinh + − du + du. 2 2 2 tanh u 2 tanh u Z0 2 Zc 2 c   u Choosing c such that 2√n sinh 2 = 1 and making the substitution y = 2√n sinh 2 , this becomes γ 1 πe f(y) f(0) ∞ f(y) f(0) log + − dy + dy 2 0 y 1 y Z γ Z 1 πe 1 ∞ f(y)+ f(y− ) f(0) = f(0) log + − dy. 2 2 y Z0 Similarly, we have (2.10) 1 1 g′(u) 1 ∞ g(0) g(u) r tanh(πr)h(r) dr = du = − du 12√n −12√n sinh(u/2) 12√n sinh(u/2) tanh(u/2) ZR ZR Z0 1 f(0) f(y) = − dy. 6 y2 ZR  Next, suppose that N > 1. In this case it is helpful to restrict the trace formula to the newforms of level N. To be precise, if M , M are positive integers such that M M N and 1 2 1 2 | M1 = N, then there is a linear map LM1,M2 : (M1,λ) (N,λ) which sends f (M1,λ) to the6 function z f(M z). Let new(N,λ)A (N,λ→A) denote the “new” subspace∈A of forms 7→ 2 A ⊆A that are orthogonal (with respect to the Petersson inner product) to the images of LM1,M2 for all M1, M2. For D Z, let ∈ ϕ(N) 6 if D =0, Λ(N) 2 (2.11) c◦ (D)= if D = ℓ =0, N  (ℓ,N ∞) 6 cN (D) otherwise, 9  where cN is as defined in (1.4). Then the trace formula for level N is as follows. Proposition 2.2. Let n, f and h be as in Proposition 2.1, and let N > 1 be a squarefree integer with (n, N)=1. Then

1 Tr Tn new(N,λ)h λ |A − 4 λ R>0 X∈ q  f √D if D> 0, √ D f(y) = c◦ (D)  | | dy if D< 0, (2.12) N π R y2+ D t Z  f(0) f(y) | | 2 − D=Xt∈ 4n  R y2 dy if D =0 − R ∞ σ1( n)R i r r n µ(N) | | h 2Λ(N) N − f aN . − n 2 − − aN r   a Z>0 r=0 | | X∈a n X   p | Proof. Specializing the formula in [Str16, 2.2] to trivial nebentypus character, we have the § following trace formula for newforms on Γ0(N), with notation as in (2.5):

µ(N)σ1( n ) i 1 | | h + Tr Tn new(N,λ)h λ n 2 |A − 4   λ R>0 | | X∈ q  p + d = h (r[c]) r[1]× : r[c]× 1 A(t, n) p − t Z  c ℓ p N    √t2X∈4n/Z (c,NX|)=1   Y| − ∈ (2.13) ϕ(N) r tanh(πr)h(r) dr if √n Z, + 12√n R ∈ (0R otherwise a2 g log ∞ 2 n r a + Λ(N) 2Λ(N) N − g log 2r log N . (N ∞, a n/a  ) − n − a Z>0 | − | a Z>0 r=0   a n,X∈ a2=n X∈a n X | 6 |

Applying (2.6) with D replaced by D/(N ∞,ℓ) and comparing to the definition (1.4), we find that c ψd(p) d L(1, ψ ) 1 1 = c◦ (D). d ℓ − p · p − N c ℓ p c   p N    (c,NX|)=1 Y| Y| Hence, following the derivation of (2.7), we get

+ d h (r[c]) r[1]× : r[c]× 1 A(t, n) p − c ℓ p N    (c,NX|)=1   Y| f √D if D > 0, = cN◦ (D) √ D f(y) | | ( π R D +y2 dy if D < 0. | | When n is a square, the corresponding term of (2.13)R is, by (2.10), ϕ(N) f(0) f(y) −2 dy, 6 R y Z 10 and this matches the contribution to (2.12) from D = 0. Similarly, the terms of (2.12) corresponding to D = ℓ2 = 0 match the first sum on the last line of (2.13).  6 3. Specialization of the test function In this section, we compute the terms of Propositions 2.1 and 2.2 explicitly for q(v) = s [4(v + 1)]− . We change notation slightly, replacing n by n, where n Z . ± ∈ >0 Proposition 3.1. Let s C with (s) > 1 and n Z . Define ∈ ℜ 2 ∈ >0 1 1 if x =0, sB(s, 2 ) Φ(x, s)= s 1 x− Ix s, 2 if 0

σ1(n) 1 1 Tr Tn (1,λ)B(s + ir, s ir)+ B s ,s + |A − √n − 2 2 λ R>0   X∈1 2 λ= 4 +r 1 σ (n) φ 1 σ (n) B(s ir, s + ir) 2ir ′ + ir dr 0 B(s,s) (3.1) − 4π − nir φ 2 − 4 ZR   t2 √ L(1, ψD)Φ 4n ,s if D / Z, 2 2 ∈ s Λ(m)(1 m 1)Φ t ,s +Ψ t ,s if 0 = √D Z, =4−  m √D  − 4n 4n | − Γ(s+ 1 ) 6 ∈ t Z  1 1 π 2 if D=Xt∈2 4n P2 ψ(s)+ γ + log n + 6 n Γ(s)  D =0, − and   p σ1(n) 1 1 Tr T n (1,λ)B(s + ir, s ir)+ B s ,s + − |A − √n − 2 2 λ R>0   X∈1 2 λ= 4 +r 1 σ (n) φ 1 σ (n) (3.2) B(s ir, s + ir) 2ir ′ + ir dr 0 B(s,s) − 4π − nir φ 2 − 4 ZR   n s L(1, ψ ) if √D / Z, = D ∈ 1 1 1 √ D ( m √D Λ(m) 1 m− + 2 ψ(s + 2 ) ψ(s) if D Z. t Z | − − ∈ D=Xt∈2+4n   P   Both (3.1) and (3.2) continue to meromorphic functions on C and are holomorphic for (s) > 0, apart from simple poles of residue σ1(n) at s = 1 . ℜ √n 2 11 s Proof. With q(v)= 4(1 + v) − we have

  2s 2s 2 u iru u − iru u(s+ir) u − h(r)= q sinh 2 e du = 2 cosh 2 e du = e e +1 du (3.3) ZR ZR ZR ∞ s+ir  2s dx   = x (x + 1)− = B(s + ir, s ir), x − Z0 by [GR07, 3.194(3)]. By Stirling’s formula, for any compact set K C that omits all poles of π r ⊂ B(s + ir, s ir), the estimate h(r) = B(s + ir, s ir) e− | | holds uniformly for s K. − | | | − |≪ 1 ∈ Hence this is a suitable choice of test function for any fixed s with (s) > 2 . Further, when combined with the Weyl-type estimate ℜ

2 Tr T n (1,λ) n T , ± A 1 2 | ≪ λ= +r R>0 4 ∈ Xr T | |≤ we see that the sums on the left-hand sides of (3.1) and (3.2) continue to meromorphic functions of s C. By (2.3), (3.1) and (3.2) are ∈ 1 Tr T n (1,λ)h λ F (a), ± |A − 4 − λ R≥0 a n X∈ q  X| 2 and it remains to evaluate t Z W (t 4n). ∈ ∓ s 2s 2 Let us first consider (3.2). Then f(y)= n y − , and we have D = t +4n > 0. Making P | | the substitution y = D/x, we get

1 1 1 2s ps s 1 s s 1 s 2 s ∞ y− D− x − D− x − x − D− 1 dy = dx = − dx = ψ(s + 2 ) ψ(s) , √D y + √D 2 0 1+ √x 2 0 1 x 2 − Z Z Z −  by [GR07, 8.361(4)]. This yields the right-hand side of (3.2). s 2 s 2 Next we consider (3.1), in which case f(y)= n (y +4n)− and we have D = t 4n. For D< 0, −

2 s f(y) s ∞ (y +4n)− s ∞ s 1 1 dy = n 2 dy = n (y +4n)− (y + D )− y− 2 dy y2 + D y2 + D | | ZR | | Z0 | | Z0 s s 1 1 1 1 D = n (4n)− D − 2 B ,s + F s, ; s +1;1 | | | | 2 2 2 1 2 − 4n     2 s 1 1 1 1 t − s s 2 = n (4n)− D − B ,s + sB t2 s, , | | 2 2 4n 2 4n       by [GR07, 3.197(1)]. Since 1 1 √πΓ(s + 1 ) πΓ(s + 1 ) π sB ,s + = 2 = 2 = , 2 2 Γ(s + 1) Γ(s)Γ( 1 ) B(s, 1 )   2 2 we obtain 2 s D f(y) s 1 t − − 2 (3.4) | 2 dy =4 I t s, . π y + D 4n 2 4n p R     Z | | 12 For a sufficiently small ε> 0, we have

s 2 s 2s s 1 2u u (3.5) f(y)= n (y +4n)− = y− n B( u,s + u)y− (4n) du, 2πi (u)= ε − Zℜ − by [GR07, 6.422(3)]. Hence, for 0 = √D Z, 6 ∈ 2u 2s ∞ f(y) 1 ∞ y dy = ns B( u,s + u) − − dy (4n)u du √D y + √D 2πi (u)= ε − √D y + √D Z Zℜ − Z s+u 2s 1 1 4n 1 =2− − B( u,s + u) ψ u + s + ψ(u + s) du. 2πi (u)= ε − D 2 − Zℜ −       For D = 0, s 2 s s 2 s ∞ f(0) f(y) s ∞ (4n)− (y +4n)− 4− ∞ 1 (y + 1)− −2 dy = n − 2 dy = − 2 dy 0 y 0 y √4n 0 y Z Z s Z 4− 1 2 s ∞ 2 s 1 = y− 1 (y + 1)− ∞ +2s (y + 1)− − dy . √4n − − 0  Z0  By [GR07, 3.251(2)],   ∞ 2 s 1 1 1 1 (y + 1)− − dy = B ,s + , 2 2 2 Z0   so that s s 1 ∞ f(0) f(y) 4− 1 1 4− √π Γ(s + ) (3.6) − dy = sB ,s + = 2 . y2 √4n 2 2 √4n Γ(s) Z0   Next, we have

1 1 1 ∞ f(y)+ f(y− ) f(0) f(y)+ f(y− ) f(0) − dy =2 − dy 0 y 0 y Z Z 1 1 1 1 f(y− ) =2 f ′(ty) dtdy +2 dy. y Z0 Z0 Z0 By (3.5), we have

s 1 2s 2u 1 u f ′(ty)= n B( u,s + u)( 2s 2u)(ty)− − − (4n) du 2πi (u)= ε − − − Zℜ − s 1 2s 2u 1 u = n B( u,s + u)( 2s 2u)(ty)− − − (4n) du, 2πi (u)= ε (s) − − − Zℜ − −ℜ upon moving the line of integration to (u) = ε (s), so that (u) (s) > 0. Therefore, ℜ − − ℜ −ℜ − ℜ 1 1 s s 1 B( u,s + u) u+s 2 f ′(ty) dtdy = n (4n)− − (4n) du 0 0 2πi (u)= ε (s) u s Z Z Zℜ − −ℜ − − 4n s s s 1 u+s 1 =4− ψ(s) γ + log(4n) n (4n)− B( u,s + u)t − dudt − − 0 2πi (u)= ε − Z Zℜ −  4n s s s s 1 =4− ψ(s) γ + log(4n) 4− (t + 1)− t − dt, − − Z0 13  by [GR07, 6.422(3)], for (s) > 0. On the other hand, ℜ 1 1 1 4n f(y− ) s 2 s 2s 1 s s s 1 2 dy =2n (1+4ny )− y − dy =4− (t + 1)− t − dt, y Z0 Z0 Z0 and thus 1 ∞ f(y)+ f(y− ) f(0) s − dy =4− ψ(s) γ + log(4n) . y − Z0 It remains only to prove that the integral  1 σ (n) φ 1 F (s)= B(s ir, s + ir) 2ir ′ + ir dr 4π − nir φ 2 ZR   has meromorphic continuation to s C. Clearly F (s) is analytic for (s) > 0. To get meromorphic continuation to (s) ∈0, we put u = ir and then deform theℜ contour around u = 0: ℜ ≤ 1 σ (n) ζ ′ ζ ′ F (s)= B(s u,s + u) 2u ∗ (2u)+ ∗ (1+2u) du, 4πi − nu − ζ ζ ZC0  ∗ ∗  1 1 where C0 = u = it : t 2 u C : u = 2 , (u) 0 . Now we replace u by u in | | ≥ ∪ ∗∈′ | | ℜ ≥ − the half of the integral containing ζ (2u) and move the contour back to C :   ζ∗ 0

1 1 σ (n) ζ ′ F (s)= B(s,s)σ (n)+ B(s u,s + u) 2u ∗ (1+2u) du. −4 0 2πi − nu ζ ZC0 ∗ 1 Now let M Z 0, replace u by u + s, and shift the contour to (u)= M . Then we have ∈ ≥ ℜ − 2 M 1 m − ( 1) Γ(2s + m) σ (n) ζ∗′ F (s)= − 2s+2m (1+2s +2m) m! Γ(2s) ns+m ζ m=0 ∗ X 1 1 σ2s+2u(n) ζ∗′ B(s,s)σ0(n)+ B( u, 2s + u) s+u (1+2s +2u) du, − 4 2πi (u)=M 1 − n ζ∗ Zℜ − 2 1 M and this last line continues meromorphically to (s) > 4 2 . Taking M arbitarily large, we conclude the meromorphic continuation of F (ℜs) to C. − 

Proposition 3.2. Let N > 1 be a squarefree integer, n Z>0 with (n, N)=1 and s C with (s) > 1 . Then ∈ ∈ ℜ 2

σ1(n) 1 1 (3.7) Tr Tn new(N,λ)B(s + ir, s ir)+ µ(N) B s ,s + |A − √n − 2 2 λ R>0   X∈1 λ= +r2 4

1 ∞ ir 1 2ir 1 + 2Λ(N) B(s ir, s + ir)σ 2ir(n)n 1 N − − − dr 2π − − − Z−∞ t2  if s Φ 4n ,s D =0, =4− c◦ (D) Γ(s+ 1 ) 6 N 1 π 2 if D =0 t Z ( 2 n Γ(s) D=Xt∈2 4n − 14 p and

σ1(n) 1 1 (3.8) Tr T n new(N,λ)B(s + ir, s ir)+ µ(N) B s ,s + − |A − √n − 2 2 λ R>0   X∈1 λ= +r2 4

1 ∞ ir 1 2ir 1 + 2Λ(N) B(s ir, s + ir)σ 2ir(n)n 1 N − − − dr 2π − − − Z−∞  c (D) = ns N◦ , Ds t Z D=Xt∈2+4n where cN◦ is as defined in (2.11). Both (3.7) and (3.8) continue to meromorphic functions 7 σ1(n) on C and are holomorphic for (s) > 64 , apart from simple poles of residue µ(N) √n at 1 ℜ s = 2 . s Proof. With q(v) = [4(1 + v)]− , as in the proof of Proposition 3.1, we have h(r) = B(s + ir, s ir). Hence, by (2.12), the left-hand sides of (3.8) and (3.7) are − 1 Tr T n new(N,λ)h λ = Tr Tn new(N,λ)B(s + ir, s ir). ± |A − 4 |A − λ R>0 λ R>0 X∈ q  X∈1 λ= +r2 4 s 2s 2 Let us first consider (3.8). Then f(y)= n y − , and D = t +4n> 0, so that | | s s f(√D)= n D− . 2 2 s 2 Now we consider (3.7), in which case f(y)= n (y +4n)− and D = t 4n. For D = 0, − s 1 f(0) f(y) 4− √π Γ(s + ) − dy = 2 , y2 √4n Γ(s) ZR by (3.6). For D< 0, 2 s D f(y) s 1 t − 2 | | 2 dy =4− I t s, , π D + y 4n 2 4n p ZR | |     by (3.4). For D = t2 4n with n 1, ± ≥ n n 2s f aN r = ns aN r + − . − aN r aN r By [GR07, 6.422(1)], for 1  (s) <σ< (s), we have  −ℜ ℜ 2s u s r n − 1 n n aN + r = B(s u,s + u) 2 2r du, aN 2πi (u)=σ − a N   Zℜ   so that

∞ n 1 1 r r u 1 2u − N − f aN r = B(s u,s + u)σ 2u(n)n 1 N − − du. − aN 2πi (u)=σ − − − a Z>0 r=0 Zℜ X∈a n X    | This integral and the sum over λ have meromorphic continuation to s C, by similar arguments to those of Proposition 3.1. Finally, the fact that the sum over λ∈ is holomorphic 15 7 for (s) > 64 follows from the best known bound towards the Selberg eigenvalue conjecture, dueℜ to Kim and Sarnak [Kim03].  4. Proofs of the main results 4.1. Proof of Theorem 1.1. By (3.2) in Proposition 3.1, the series given in (1) can be written as L(1, ψt2+4n) s = n− (F (s)+ F (s)+ F (s)) , (t2 +4n)s 1 2 3 t Z √t2X+4∈ n/Z ∈ where σ1(n) 1 1 F1(s)= Tr T n (1,λ)B(s + ir, s ir)+ B s ,s + , − |A − √n − 2 2 λ R>0   X∈1 2 λ= 4 +r 1 σ (n) φ 1 σ (n) F (s)= B(s ir, s + ir) 2ir ′ + ir dr 0 B(s,s) 2 −4π − nir φ 2 − 4 ZR   and 1 1 1 m ℓ Λ(m)(1 m− )+ 2 ψ s + 2 ψ(s) F (s)= | − − . 3 − ℓ2s t Z P   2 ∈2 t +4n=Xℓ ,ℓ Z>0 ∈ The meromorphic continuation of F1(s) and F2(s) was shown in the proof of Proposi- 1 tion 3.1. In particular, F1(s) has simple poles at s = m + 2 and s = m ir for m Z 0, ρ 1 − − ± ∈ ≥ while F2(s) has simple poles at s = m + − for m Z 0 and ρ a zero or pole of ζ∗(s). − 2 ∈ ≥ Finally, the series F3(s) has finitely many terms and is entire apart from simple poles for 1 s 2 Z 0. Moreover, one can check that the poles of F2(s) and F3(s) at s = 0 cancel out, ∈ − ≥ 1 so the only poles of (1.2) for (s) 0 are at s = 2 and s = ir, with residues σ 1(n) and ir ℜ ≥ ± − n∓ Tr T n (1, 1 +r2), respectively. This proves (1). − A 4 | 4n 2 Let N be a prime and n be a positive integer such that − = 1. Then N ∤ t +4n = N − dℓ2 = D and  t2 +4n c◦ (D)=(ψ (N) 1) L(1, ψ )= 1 L(1, ψ 2 ). N D − D N − t +4n    Combining (3.8) in Proposition 3.2 and (3.2) in Proposition 3.1, we see that the series

t2+4n 2 L(1, ψ 2 ) c (t +4n) L(1, ψ 2 ) t +4n N N◦ + t +4n = (t2 +4n)s (t2 +4n)s (t2 +4n)s  t Z t Z t Z √t2X+4∈ n/Z √t2X+4∈ n/Z √t2X+4∈ n/Z ∈ ∈ ∈ has meromorphic continuation to C. This proves (2). 4n Finally, we turn to (3). If N = 2 then there are no primes n satisfying − = 1. N − However, the Selberg eigenvalue conjecture is true for Γ0(2) [Hux85], so (3) is vacuously true in this case. Henceforth we will assume that N > 2.  If the Selberg conjecture holds for Γ0(N) then, since it also holds for Γ0(1), the first terms of both (3.2) and (3.8) are holomorphic for (s) > 0, and the second terms cancel. In ℜ the other direction, let f ∞ be a complete sequence of arithmetically normalized Hecke– { j}j=1 Maass newforms on Γ (N) H, with parities ǫ 0, 1 , Laplace eigenvalues 1 +r2 and Hecke 0 \ j ∈{ } 4 j eigenvalues λj(n). We need the following lemma. 16 Lemma 4.1. Let J be a finite set of positive integers and let cj C× be given for each 4n ∈ j J. Then there is a n such that − = 1 and ∈ N − c λ (n) =0 .  j j 6 j J X∈ Proof. The main tool is the Rankin–Selberg method, from which it follows that if f and g are normalized Hecke–Maass newforms (of possibly different levels) with Fourier coefficients λf (n) and λg(n), respectively, then 1 1 if f = g, (4.1) lim λf (p)λg(p)= x π(x) 0 if f = g, →∞ p x ( X≤ 6 where the sum runs through all prime numbers p x. ≤ For any prime p, put Sp = j J cjλj(p). For large x N, we consider the sum ∈ ≥ 1 1 4 p 1 S 2 = P S 2 − S 2 S 2. | p| 2 | p| − 2 N N | p| − 2| N | p x p x p x ≤ ≤   ≤   −4Xp = 1 X X ( N ) − Opening up the first sum, we have S 2 = c c λ (p)λ (p). | p| j k j k p x j,k J p x X≤ X∈ X≤ By (4.1), the inner sum is o(π(x)) if j = k and (1+ o(1))π(x) otherwise; thus, in total, the 2 6 first sum is j J cj + o(1) π(x). ∈ | | Expanding the second sum in the same way, we obtain P  p c c λ (p)λ (p). j k N j k j,k J p x X∈ X≤   p Since fj is a newform of prime level N, N λj(p) is the pth Fourier coefficient of a newform 2 of level N (which is therefore distinct from fk for every k). Thus, (4.1) implies that the second sum is o(π(x)).  Finally 1 S 2 is bounded independent of x. Putting these together, we have 2 | N | 1 S 2 = c 2 + o(1) π(x) as x . | p| 2 | j| →∞ p x j J ! ≤ ∈ −4Xp = 1 X ( N ) − Since cj = 0, the last line is positive for large enough x, and thus there exists p satisfying 4p 6 − = 1 and S = 0, as required.  N − p 6 To conclude the proof, suppose that the Selberg conjecture is false for Γ0(N). Let λmin 1 1 2 ǫ∈j (0, 4 ) be the smallest non-zero eigenvalue, and put J = j Z>0 : 4 +rj = λmin , cj =( 1) . { ∈ 4n } − Then Lemma 4.1 implies that there exists a prime n such that − = 1 and N − ǫj 0 = ( 1) λj(n) = Tr T n (N,λ ).  6 − − |A min j J X∈ Thus, for this choice of n, (1.3) has a pole at s = 1 λ > 0.  4 − min 17 q Remark. Using effective estimates in the Rankin–Selberg method, one could give an upper bound for the n produced by Lemma 4.1, so part (3) of Theorem 1.1 could be strengthened to an equivalence with finitely many series. Alternatively, using known results from functoriality would enable equivalences with thinner infinite sequences of n; for instance, if N 3 (mod 4), then using functoriality of the kth symmetric powers for k 4, we may take≡n to be the fourth power of a prime. ≤

s s 4.2. Proof of Theorem 1.2. Define EN (s) = p N (1 p− ). We multiply (3.8) by n− | − · Γ (2s)ζ (4s)/E (2s + 1) and sum over square values of n co-prime to N. The result can R N∗ N Q be expressed in the form L1 + L2 + L3 = R, where 2 ΓR(2s)ζN∗ (4s) ΓR(2s 1)ΓR(2s + 1) σ1(n ) L1 = µ(N) − 2s+1 , EN (2s + 1) ΓR(4s) n n Z>0 (n,NX∈ )=1

∞ 2 ΓR(2s)ζN∗ (4s) ǫj ΓR(2s 2irj)ΓR(2s +2irj) λj(n ) L2 = ( 1) − 2s , EN (2s + 1) − ΓR(4s) n j=1 n Z>0 X (n,NX∈ )=1 2 2 ir ΓR(2s)ζN∗ (4s) 1 ∞ σ 2ir(n )(n ) 1 2ir 1 − − − − L3 = 2Λ(N) B(s ir, s + ir) 2s 1 N dr, EN (2s + 1) 2π − n − Z−∞ n Z>0 (n,NX∈ )=1  and 2 2 ΓR(2s)ζN∗ (4s) cN◦ (t +4n ) R = 2 2 s . EN (2s + 1) (t +4n ) t Z,n Z>0 ∈(n,NX∈)=1 2k k By Atkin–Lehner theory, for any p N, we have λ (p )= p− . Thus, | j λ (n2) ∞ λ (n2) j = E (2s + 1) j , n2s N n2s n Z>0 n=1 (n,NX∈ )=1 X so that ∞ ǫ 2 L = ( 1) j L∗(2s, Sym f ). 2 − j j=1 X Similarly, 2 σ1(n ) EN (2s)EN (2s + 1)EN (2s 1) ζ(2s)ζ(2s + 1)ζ(2s 1) 2s+1 = − − , n EN (4s) ζ(4s) n Z>0 (n,NX∈ )=1 so that 2s L = µ(N)N E (2s)E (2s 1)ζ∗(2s)ζ∗(2s + 1)ζ∗(2s 1) 1 N N − − = √Nζ∗(2s)ζ∗ ( 2s)ζ∗ (2s 1). N − N − Turning to the right-hand side, we define (M) 1 2 2 2 r (D)= 2 # (x, y) Z : D = x +4y , (y, M)=1 , ∈ 18  for M Z , so that ∈ >0 ∞ (N) ΓR(2s)ζN∗ (4s) cN◦ (D)r (D) R = s . EN (2s + 1) D D=1 2 1 X Note that cN◦ (m D)= m− cN◦ (D) for any m N ∞ and D . Hence, expanding the factor 1 (N) | ∈D of EN (2s + 1)− and writing r (x) = 0 if x is not a positive integer, we get

∞ (N) 2s 1 cN◦ (D)r (D) R =Γ (2s)ζ∗ (4s) m− − R N Ds m N ∞ D=1 X| X ∞ 2 (N) cN◦ (m D)r (D) =Γ (2s)ζ∗ (4s) R N (m2D)s m N ∞ D=1 (4.2) X| X ∞ (N) 2 cN◦ (D)r (Dm− ) =Γ (2s)ζ∗ (4s) R N Ds m N ∞ D=1 X| X ∞ cN◦ (D) (N) 2 =Γ (2s)ζ∗ (4s) r (Dm− ). R N Ds D=1 m N ∞ X X| The inner sum is evaluated by the following three lemmas. Lemma 4.2. For positive integers M,ℓ,

(M) 2 2 2 n2 1 if M =1, r (ℓ ) = # (a, n) Z>0 : a n , (n, M)=1, a + a = ℓ + ∈ | (0 if M > 1.  Proof. Put δM = 1 if M = 1 and δM = 0 otherwise. Then we have r(M)(ℓ2)= 1 # (x, y) Z2 : ℓ2 = x2 +4y2, (y, M)=1 2 ∈ = δ + # (x, n) Z Z : ℓ2 = x2 +4n2, (n, M)=1 . M  { ∈ × >0 } Note that if ℓ2 = x2 +4n2 with n> 0 then x ℓ (mod 2) and x <ℓ, so this becomes ≡ | | ℓ+x ℓ x 2 δ + # (x, n) Z Z : − = n , (n, M)=1, x ℓ (mod 2), x <ℓ M ∈ × >0 2 · 2 ≡ | | = δ + # (a, n) Z2 : a(ℓ a)= n2, (n, M)=1 M  ∈ >0 − 2 2 n2 = δM + #(a, n) Z>0 : a n , (n, M)=1, a + = ℓ . ∈ | a   Lemma 4.3. Let M,D be positive integers with M squarefree, and let p be a prime divisor of M. Then

∞ (M) 2k (M/p) 1 2 2 ordp(D)/2 2 2 r (Dp− )= r (D) # (x, y) Z : Dp− ⌊ ⌋ = x +4y , p y . − 2 ∈ | k=0 X  In particular, if ψ (p) =1, where d denotes the discriminant of Q(√D), then d 6 ∞ (M) 2k (M/p) r (Dp− )= r (D). k=0 X 19 Proof. If p2 n then | r(M)(n)= 1 # (x, y) Z2 : n = x2 +4y2, (y, M)=1 2 ∈ = r(M/p)(n) 1 # (x, y) Z2 : n = x2 +4y2, (y,M/p)=1, p y  − 2 ∈ | (M/p) (M/p) 2 = r (n) r (np− ). −  2k Now put e = ord (D)/2 . Then for k < e we may apply the above with n = Dp− : ⌊ p ⌋ (M) 2k (M/p) 2k (M/p) 2(k+1) r (Dp− )= r (Dp− ) r (Dp− ). − Hence we have the telescoping sum e ∞ (M) 2k (M) 2k (M/p) (M/p) 2e (M) 2e r (Dp− )= r (Dp− )= r (D) r (Dp− )+ r (Dp− ). − Xk=0 Xk=0 The first conclusion follows on noting that (M/p) 2e (M) 2e 1 2 2e 2 2 r (Dp− ) r (Dp− )= # (x, y) Z : Dp− = x +4y , p y . − 2 ∈ | 2e As for the second, if ordp(D) is odd then ordp(Dp− ) = 1. On the other hand, if p y then x2 +4y2 is either invertible mod p or divisible by p2. Hence | 1 2 2e 2 2 # (x, y) Z : Dp− = x +4y , p y =0 2 ∈ | in this case.  −2e Suppose now that ord (D) is even and ψ (p) =1. If p is odd then it follows that Dp = p d 6 p 2e 2 2 1, so again Dp− = x +4y is not solvable with p y. For p = 2, we distinguish between − |2e 1 2 even and odd values of d. If d is even then we have Dp− = 4 dm , where m is odd; hence, the 2e 2 2 1 2 2 2 equation Dp− = x +4y is not solvable, since 4 dm 2 or 3 (mod 4), while x +4y 0 ≡ 2e 2 ≡ or 1(mod 4). If d is odd then d 5 (mod 8) since ψd(p) = 1, so Dp− = dm 5 (mod 8). 2e 2 ≡ 2 6 ≡ Again we find that Dp− = x +4y is not solvable with y even.  Corollary 4.4. For any positive integer D, (N) 2 c◦ (D) r (Dm− )= c◦ (D)r(D) δ , N N − N,D m N ∞ X| where Λ(N) 2 2 n2 ℓ 2 (ℓ,N ∞) 1 + # (a, n) Z>0 : a n , N n, a + a = (ℓ,N ∞) if D = ℓ , δN,D = { ∈ | | } (0  otherwise. Proof. If D 2 or 3 (mod 4) then both sides vanish. If D = dℓ2 with d = 1 then ≡ ∈ D 6 cN◦ (D) = 0 unless ψd(p) = 1 for every p N; in that case, we may apply the second 6 | (N) 2 conclusion of Lemma 4.3 inductively to see that m N ∞ r (Dm− ) = r(D). Finally, if D = ℓ2 is a square then again both sides are 0 unless N| is prime, and in that case we apply P the first conclusion of Lemma 4.3 with M = p = N. The stated formula for δN,D follows from Lemma 4.2, since 1 2 2 2 ord (ℓ) 2 2 # (x, y) Z : ℓ N − N = x +4y , N y 2 ∈ | (1) 2 2 ord (ℓ) (N) 2 2 ord (ℓ) =r (ℓ N − N ) r (ℓ N − N ) − 2 =1+# (a, n) Z2 : a n2, N n, a + n = ℓ . ∈ >0 | | a (ℓ,N ∞)  20 

s We apply this to (4.2). When N is composite we have cN◦ = cN , so that R = D∞=1 cN (D)r(D)D− , which completes the proof in that case. Henceforth we assume that N is prime; in particular, s P EN (s)=1 N − . Thus, by Corollary 4.4, (4.3) − ∞ cN◦ (D)r(D) R Γ (2s)ζ∗ (4s) − R N Ds D=1 X 2 2 n2 ℓ ∞ 1 + # (a, n) Z>0 : a n , N n, a + a = (ℓ,N ∞) ∗ { ∈ | | } = Λ(N)ΓR(2s)ζN (4s) 2s − (ℓ, N ∞)ℓ Xℓ=1 n2 ∞ 2 2 k(2s+1) 1 + # (a, n) Z>0 : a n , N n, a + a = ℓ0 = Λ(N)ΓR(2s)ζN∗ (4s) N − { ∈ |2s | } − ℓ0 k=0 ℓ0 Z>0 ∈ X (ℓ0X,N)=1 2 2s Λ(N)ΓR(2s)ζN∗ (4s) n − = EN (2s)ζ(2s)+ a + . − EN (2s + 1) a n Z>0 a n2   ! X∈N n 2X| | (a+n /a,N)=1 r 2 We write n = n0N for r > 0 and (n0, N) = 1. Then the condition (a + n /a, N) = 1 is satisfied if and only if ord (a) 0, 2r , so we have N ∈{ } 2s 2s 2s n2 − ∞ n2N 2r − n2 − a + = a + 0 + aN 2r + 0 a a a n Z>0 a n2 r=1 n0 Z>0 a n2 ! ∈   ∈ 0     XN n 2X| X (n0X,N)=1 X| | (a+n /a,N)=1 2s 2s ∞ n2 − n2N 2r − =2 aN 2r + 0 =2 N 4rs a + 0 . a a r=1 n0 Z>0 a n2 r Z n0 Z>0 a n2 ∈ 0   ∈ ∈ 0   X (n0X,N)=1 X| Xr<0 (n0X,N)=1 X|

Substituting this into (4.3) and combining with R3, we obtain (4.4) ∞ cN◦ (D)r(D) EN (2s)ζ∗(2s) R ΓR(2s)ζN∗ (4s) s = Λ(N)ζN∗ (4s) − D − EN (2s + 1) D=1 X 2s 2Λ(N)Γ (2s)ζ (4s) n2N 2r − R N∗ a + N 4rs, − EN (2s + 1) a n Z>0 a n2 r Z,   (n,NX∈ )=1 X| Xr<∈ 0

which we write as R1′ + R2′ . Next, we convert R2′ into an integral by applying [GR07, 6.422(3)]: 2 2r 2s n N − 1 ΓR(2s +2u)ΓR(2s 2u) 2u r 2(u s) (4.5) a + = − a− (nN ) − du. a 2πi (u)=0 ΓR(4s)   Zℜ We have 2u 2s 2r(u s) 4rs N − − EN (2s + 1) 1 − N N = 2u 2s = 2u 1 , 1 N EN (1 2u)EN (2u +2s) − 1 N r Z, − − − − − − Xr<∈ 0 21 and

2u 2u 2s EN (2s)EN (2s +2u)EN (2s 2u) ζ(2s)ζ(2s +2u)ζ(2s 2u) a− n − = − − , EN (4s) ζ(4s) n Z>0 a n2 (n,NX∈ )=1 X| so that

2s EN (2s 2u) du R2′ L3 = 2Λ(N)N EN (2s)ζ∗(2s) − ζ∗(2s +2u)ζ∗(2s 2u) . − − (u)=0 EN (1 2u) − 2πi Zℜ − Now, since EN (2s 2u) 1 2s EN (1 2s) − = N − 1 − , E (1 2u) − E (1 2u) N −  N −  this equals 2NΛ(N)E (2s)ζ∗(2s) A(s) E (1 2s)B (s) , − N − N − N where 1  A(s)= ζ∗(2s +2u)ζ∗(2s 2u) du 2πi (u)=0 − Zℜ and 1 ζ∗(2s +2u)ζ∗(2s 2u) BN (s)= − du. 2πi (u)=0 EN (1 2u) Zℜ − Next, to compute the contribution from c c◦ , we have the following: N − N Lemma 4.5. ∞ r(ℓ2) ζ∗(4s) = ζ(2s)(A(s)+ ζ∗(4s)). ℓ2s n=1 X Proof. By Lemma 4.2 with M = 1, we have 2s ∞ r(ℓ2) ∞ n2 − = ζ(2s)+ a + . ℓ2s a ℓ=1 n=1 a n2   X X X| On the other hand, by (4.5) with r = 0, 2s ∞ 2 ∞ n − 1 ΓR(2s +2u)ΓR(2s 2u) 2 2(u s) a + = − σ 2u(n )n − du a 2πi (u)=0 ΓR(4s) − n=1 a n2   Zℜ n=1 X X| X 1 Γ (2s +2u)Γ (2s 2u) ζ(2s)ζ(2s +2u)ζ(2s 2u) ζ(2s) = R R − − du = A(s). 2πi (u)=0 ΓR(4s) ζ(4s) ζ∗(4s) Zℜ 

Comparing the definitions of cN and cN◦ , we thus have

∞ cN (D)r(D) (4.6) R L Γ (2s)ζ∗ (4s) − 3 − R N Ds D=1 X EN∗ (4s) = Λ(N)ζ∗(2s) 2NA(s) E (2s) +2NB (s)E (2s)E (1 2s) N +1 − N N N N −    2N EN (2s) + ζ∗ (4s) . N N +1 − E (2s + 1)  N  22 Note that, for prime N, E (4s) N N∗ E (2s)= E (2s)E (1 2s) N +1 − N −N +1 N N − and 1 N 1 E (4u) = N∗ , E (1 2u) − N +1 N +1 E (2u)E (1 2u) N − N N − so on making the substitution u u , (4.6) becomes 7→ 2 NΛ(N) (N + 1)EN (2s) (4.7) ζ∗(2s) (2s;0)+ ζ∗ (4s) 2 . N +1 IN N − NE (2s + 1)   N  Shifting the contour of N to (u)= σ, we pass poles at u =1 2s and u = 2s, with residues I ℜ − − − E∗ (2 4s)ζ∗(4s 1) = ζ∗ (2 4s) N − − N − and EN∗ (2s)EN∗ (1 2s) EN (2s 1) − E∗ ( 4s)ζ∗(4s)= − ζ∗ (4s), −E ( 2s)E (1+2s) N − NE (2s + 1) N N∗ − N∗ N respectively. Finally, we have E (2s 1) (N + 1)E (2s) N − +2 N =1, NEN (2s + 1) − NEN (2s + 1) so that (4.7) is NΛ(N) ζ∗(2s) (2s; σ)+ ζ∗ (4s)+ ζ∗ (2 4s) , N +1 IN − N N − as required.  2 The analytic continuation and functional equation of L∗(2s, Sym fj) were proved by Gel- bart and Jacquet [GJ78] following ideas of Shimura [Shi75]. By Stirling’s formula and the convexity bound, we have 2 (π ε) r L∗(2s, Sym f ) e− − | j |, j ≪K,ε uniformly for s K, for any compact subset K C and ε > 0. Combining this with the Weyl-type estimate∈ # j : r T T 2, we see⊂ that the series L converges absolutely to { | j| ≤ }≪ 2 an entire function of s. Similarly, N (2s; σ) converges absolutely for all s with (2s) < σ and satisfies a functional equation. I ℜ  4.3. Proof of Theorem 1.3. Let L(1, ψ )r(D) F (s)= D . Ds 0 0 and D ≪ε ∈ D √D / Z. Using this estimate in [Ten15, II.1, Cor. 2.1], for any X T 2, we have ∈ § ≥ ≥ 1 κ+iT ds X1+ε L(1, ψ )r(D)= F (s)Xs + O , D 2πi s ε T 0

1 4 +iT s ds 1 7 +ε F (s)X ε X 4 T 4 . 1 iT s ≪ Z 4 − By convexity, it follows from the first estimate in (4.8) that

3(1 σ)+ε 1 F (σ iT ) T − for σ [ , κ], ± ≪ε ∈ 4 so that κ iT ± s ds 1 5 +ε 1+ε F (s)X ε X 4 T 4 + XT − . 1 iT s ≪ Z 4 ± 1 1 2 +ε The pole at s = 2 contributes a residue of size Oε(X ), and from the pole at s = 1 we get 1 ζ∗(2)ζ∗(3) the main term, which turns out to be 2 π−1ζ∗(4) X. Hence, altogether we have 1+ε π ζ∗(2)ζ∗(3) 1 7 +ε 1 +ε X L(1, ψ )r(D)= X + O X 4 T 4 + X 2 + D 2 ζ (4) ε T D X ∗ ≤   √XD /Z ∈ 3 for any ε> 0. Taking T = X 11 yields the desired bound. To prove the meromorphic continuation of F (s) and the estimates (4.8), we compute from (3.2) that

2 ∞ L∗(2s, Sym fj) ζ∗(2s)ζ∗(2s 1)ζ∗(2s + 1) (4.9) F (s)= ( 1)ǫj + − − ζ (4s)Γ (2s) ζ (4s)Γ (2s) j=1 ∗ R ∗ R X 3 1 ζ(2s)ζ∗(2s 2ir)ζ∗(2s +2ir) φ′ 1 1 ζ∗(2s) − + ir dr − 4π ζ (4s) φ 2 − 4 ζ (4s)Γ (2s) ZR ∗   ∗ R ∞ 2 1 1 1 r(ℓ ) 2 Λ(m)(1 m− )+ ψ(s + ) ψ(s) − , − − 2 2 − ℓ2s ℓ=1 " m ℓ # X X|  2 2 λj (n ) ∞ where L∗(2s, Sym fj)=ΓR(2s)ΓR(2s 2irj)ΓR(2s +2irj)ζ(4s) n=1 n2s . We consider each term in turn. − 1 P First, by Stirling’s formula, for s = 4 + it we have

ΓR(2s 2ir)ΓR(2s +2ir) 2 2 1 π max(0, r t ) − (1 + t r )− 4 e− | |−| | , ΓR(4s) ≪ | − | uniformly for r, t R. Moreover, 1/ζ(4s) log(1+ t ), and by the uniform convexity bound [Har02, Cor. 2], we∈ have ≪ | |

1 2 2 2 4 +ε L(2s, Sym fj) ε (1 + t )(1 + t rj ) . ≪ 24 | | | − |  2 From these estimates and the Weyl bound # j : rj T T , we see that the sum over 9 +ε { | | ≤ }≪ j in (4.9) is O (1 + t ) 4 , as claimed. Moreover, by Cauchy–Schwarz, we have ε | | 2 T 1 2 T ∞ L∗( +2it, Sym fj) ∞ 1 2 2 2 2 2 π max(0, rj t ) 1 dt log T (1 + t rj )− e− | |−| | dt T ζ∗(1+4it)ΓR( 2 +2it) ! ≪ T | − | j=1 Z− j=1 Z− X X ∞ T 1 2 2 π max(0, r t ) L( +2it, Sym f ) e− | j |−| | dt · | 2 j | j=1 T X Z− ∞ T 2 1 2 2 π max(0, r t ) (T log T ) L( +2it, Sym f ) e− | j |−| | dt. ≪ | 2 j | j=1 T X Z− By [KSS06, Thm. 2] and [RW03, Cor. C], we have T 3 1 2 2 ε 2 L( 2 +2it, Sym fj) dt ε (1 + rj) T log T, T | | ≪ Z− and altogether this yields

1 2 ∞ T L∗( 2 +2it, Sym fj) 11 +ε dt T 4 . ζ (1+4it)Γ ( 1 +2it) ≪ε j=1 T ∗ R 2 X Z− 5 4 +ε For all remaining terms we obtain a pointwise bound of at most Oε (1 + t ) , which suffices for both estimates in (4.8). First, we have | |  ζ(2s)ζ∗(2s 1)ζ∗(2s + 1) 3 +ε − ε (1 + t ) 4 . ζ∗(4s) ≪ | | Next, by a similar analysis to the proof of Proposition 2.1, the second line of (4.9) can be written as

1 ζ∗′ 1 ζ∗(4s 1)ζ∗′(2s) ζ(2s) (2s + 1) − 2 ζ∗ − 2 ζ∗(4s)ΓR(2s)

1 ζ(2s)ζ∗(2s 2u)ζ∗(2s +2u) ζ∗′ − (1+2u) du, − 2πi (u)=σ ζ∗(4s) ζ∗ Zℜ 1 1 for any σ > 4 , and the integral is ζ(2s)/ζ∗(4s) times an analytic function for (s) ( 2 σ, σ). 1 1 ℜ ∈ − The first two terms are analytic for (s) 4 apart from a pole at s = 2 , and by the convexity 1 1 ℜ ≥ 1 +ε 1 bounds for ζ( +2it) and ζ′( +2it), we see that they are O (1 + t ) 4 for s = + it. 2 2 ε | | 4 Taking σ = 1 + ε and writing s = 1 + it, u = 1 + ε + ir, we find by a similar analysis to the 4 4 4  above that

ζ(2s)ζ∗(2s 2u)ζ∗(2s +2u) ζ∗′ 1 +ε 2 2 ε π max(0, r t ) − (1+2u) ε (1 + t ) 4 (1 + t r ) e− | |−| | , ζ∗(4s) ζ∗ ≪ | | | − | 5 +ε so the integral is O (1 + t ) 4 . ε | | Turning to the third line of (4.8), note first that m ℓ Λ(m) = log ℓ, and  | 2 2 ∞ (r(ℓ ) 2) log ℓ 1 d ζ (2sP)L(2s, ψ 4) − = − 2ζ(2s) . − ℓ2s 2 ds ζ(4s) − ℓ=1   X 25 3 +ε 1 Again using the convexity bound, this is O (1 + t ) 4 for s = + it. Similarly, ε | | 4 ∞ 2 2 1 1 r(ℓ ) 2 1 1  ζ (2s)L(2s, ψ 4) ψ(s + ) ψ(s) − = ψ(s + ) ψ(s) − 2ζ(2s) , −2 2 − ℓ2s −2 2 − ζ(4s) − ℓ=1    X  1 +ε 1 and this is O (1 + t ) 4 for s = + it. Finally, we have ε | | 4 ∞  2s Λ(m) ζ′ 2 ℓ− =2ζ(2s) (2s + 1), − m ζ ℓ=1 m ℓ X X| 1 +ε 1 which is O (1 + t ) 4 for s = + it, and ε | | 4 ∞ 2 2s 1 2 2s  Λ(m) ζ (2s)L(2s, ψ 4) log p Ep(p− − ) − r(ℓ )ℓ− = 1 2s , m ζ(4s) p 1 − Ep(p− ) ℓ=1 m ℓ p   X X| X − where E (T ) = 1+T . The sum over p is analytic and bounded for (s) 1 , so p (1 T )(1 ψ−4 (p)T ) 4 − − ℜ ≥ 3 +ε 1 the last line is O (1 + t ) 4 for s = + it.  ε | | 4  References [CL01] J. Brian Conrey and Xian-Jin Li. On the trace of Hecke operators for Maass forms for congruence subgroups. Forum Math., 13(4):447–484, 2001. [GJ78] Stephen Gelbart and Herv´eJacquet. A relation between automorphic representations of GL(2) and GL(3). Ann. Sci. Ecole´ Norm. Sup. (4), 11(4):471–542, 1978. [GR07] I. S. Gradshteyn and I. M. Ryzhik. Table of integrals, series, and products. Elsevier/Academic Press, Amsterdam, seventh edition, 2007. Translated from the Russian, Translation edited and with a preface by Alan Jeffrey and Daniel Zwillinger, With one CD-ROM (Windows, Macintosh and UNIX). [Har02] Gergely Harcos. Uniform approximate functional equation for principal L-functions. Int. Math. Res. Not., (18):923–932, 2002. [Has13] Yasufumi Hashimoto. Asymptotic formulas for class number sums of indefinite binary quadratic forms on arithmetic progressions. Int. J. , 9(1):27–51, 2013. [Hej83] Dennis A. Hejhal. The Selberg trace formula for PSL(2, R). Vol. 2, volume 1001 of Lecture Notes in . Springer-Verlag, Berlin, 1983. [Hux85] M. N. Huxley. Introduction to Kloostermania. In Elementary and analytic theory of numbers (War- saw, 1982), volume 17 of Banach Center Publ., pages 217–306. PWN, Warsaw, 1985. [Kim03] Henry H. Kim. Functoriality for the exterior square of GL4 and the symmetric fourth of GL2. J. Amer. Math. Soc., 16(1):139–183, 2003. With appendix 1 by Dinakar Ramakrishnan and appendix 2 by Kim and Peter Sarnak. [KSS06] W. Kohnen, A. Sankaranarayanan, and J. Sengupta. The quadratic mean of automorphic L- functions. In Automorphic forms and zeta functions, pages 262–279. World Sci. Publ., Hackensack, NJ, 2006. [Li05] Xian-Jin Li. On the trace of Hecke operators for Maass forms for congruence subgroups. II. Forum Math., 17(1):1–30, 2005. [Li08] Xian-Jin Li. On exceptional eigenvalues of the Laplacian for Γ0(N). Proc. Amer. Math. Soc., 136(6):1945–1953, 2008. [Mot92] Y¯oichi Motohashi. Spectral mean values of Maass waveform L-functions. J. Number Theory, 42(3):258–284, 1992. [Rau09] Nicole Raulf. Asymptotics of class numbers for progressions and for fundamental discriminants. Forum Math., 21(2):221–257, 2009. [RW03] Dinakar Ramakrishnan and Song Wang. On the exceptional zeros of Rankin-Selberg L-functions. Compositio Math., 135(2):211–244, 2003. 26 [RW11] Robert C. Rhoades and Matthias Waldherr. A Maass lifting of Θ3 and class numbers of real and imaginary quadratic fields. Math. Res. Lett., 18(5):1001–1012, 2011. [Sar82] Peter Sarnak. Class numbers of indefinite binary quadratic forms. J. Number Theory, 15(2):229–247, 1982. [Sar85] Peter C. Sarnak. Class numbers of indefinite binary quadratic forms. II. J. Number Theory, 21(3):333–346, 1985. [Shi75] . On the holomorphy of certain Dirichlet series. Proc. London Math. Soc. (3), 31(1):79– 98, 1975. [Str16] Andreas Str¨ombergsson. Explicit trace formulas for Hecke operators. preprint, 2016. [Ten15] G´erald Tenenbaum. Introduction to analytic and probabilistic number theory, volume 163 of Grad- uate Studies in Mathematics. American Mathematical Society, Providence, RI, third edition, 2015. Translated from the 2008 French edition by Patrick D. F. Ion.

Howard House, University of Bristol, Queens Ave, Bristol, BS8 1SN, United Kingdom E-mail address: [email protected], [email protected]

27