# Logarithmic average of the Legendre symbol

My question is simple: can we show that the sum

$$\sum_{k=1}^{p-1} \frac{\left( \frac{k}{p} \right)}{k}$$

is positive for all primes $$p$$ where $$(k/p)$$ denotes the Legendre symbol modulo $$p$$, i.e. equal to $$1$$ if $$k$$ is a quadratic residue modulo $$p$$ and equal to $$-1$$ otherwise? After dividing this by $$H_p$$ we can see this as a kind of "logarithmic average" of the Legendre symbol over $$\mathbf Z/p \mathbf Z$$.

If we ask that the sum be infinite, then we can show this by apealing to the standard result about the nonvanishing of $$L(1, \chi)$$ for $$\chi$$ a nontrivial Dirichlet character. In this case we could possibly even exert greater control over the $$L$$-function by linking it to the Dedekind zeta function of a number field, for example.

However, passing from what we might know about $$L(s, \chi)$$ to a bound on this truncated sum seems nontrivial. It's possible that there's a purely elementary argument that would do the trick here, but if there is I haven't been able to find it in a short time, so I've decided to ask the question here instead.

Note: I've confirmed by computer search that the sum in question is indeed positive for all primes less than $$2000$$. However, this doesn't necessarily mean much, since the average in question is connected to the Liouville function whose logarithmic mean has a strong bias to be positive due to $$\zeta(1/2)$$ being negative.

In particular, any attempt to construct a possible completely multiplicative sign sequence to give a counterexample runs afoul of this problem, so even if the statement doesn't hold, the first counterexample prime $$p$$ may be quite large.

Consider the infinite sum $$\sum_{k=p}^{\infty} \frac1k \left( \frac kp \right).$$ Polya Vinogradov inequality implies that for $$|A(t)|=\left| \sum_{k\leq t} \left( \frac kp \right)\right|< p^{1/2} \log p.$$ By partial summations, we have $$\sum_{k=p}^{\infty} \frac1k \left( \frac kp \right)=\int_{p-}^{\infty}\frac{dA(t)}t = \frac{A(t)}t \bigg\vert_{p-}^{\infty} +\int_{p-}^{\infty} \frac{A(t)}{t^2} dt.$$ Thus, we have $$\left| \sum_{k=p}^{\infty} \frac1k \left( \frac kp \right)\right|\leq \frac{2\log p}{p^{1/2}}.$$ The sum of our interest is $$L(1,\chi)-\sum_{k=p}^{\infty} \frac1k \left( \frac kp \right)$$ where $$\chi(k)=\left( \frac kp \right)$$.
By Siegel's theorem, we have an ineffective (we know the existence of $$C_1(\epsilon)>0$$ but cannot write it explicitly) estimate $$L(1,\chi)> C_1(\epsilon) p^{-\epsilon}.$$ Take $$\epsilon=1/4$$ and let $$C=C_1(1/4)$$. Then $$\sum_{k=1}^{p-1} \frac1k \left( \frac kp \right)= L(1,\chi)-\sum_{k=p}^{\infty} \frac1k \left( \frac kp \right)> \frac C{p^{1/4}} - \frac{2\log p}{p^{1/2}}.$$ Therefore, for sufficiently large $$p$$ (meaning that there exists $$p_0$$ such that for all $$p\geq p_0$$), we have $$\sum_{k=1}^{p-1} \frac1k \left( \frac kp \right)>0.$$
• Nice argument. This is probably the best we can do for this question, though obviously the gap between the ineffective $p_0$ given by this argument and the point up to which checking the fact by brute force will be feasible is quite large. I'll accept this answer for now, though I'm open to another answer which makes this $p_0$ effective. Commented Feb 8, 2022 at 21:17