Computations for the Introduction

The work of Kevin McCurley

The paper
	Explicit Estimates for Primes in Progressions, by Kevin S. McCurley
contains the following as Theorem 2.1 on page 267.

THEOREM 2.1. Let T≥1 and χ be a primitive nonprincipal character modulo q. If 0<η≤(1/2), then
	|N(T,χ)-(T/π)log ((q T)/(2π e))| < (Subscript[C, 1]) log q T + (Subscript[C, 2]),
where
	(Subscript[C, 1])=((1+2η)/(π log 2)),
	(Subscript[C, 2])=0.3058-0.268η+((4 log ζ(1+η))/(log 2))-((2log ζ(2+2η))/(log 2))+(2/π)log ζ((3/2)+2η).

For example, with η=(1/2), we have (Subscript[C, 1])≤ 0.919 and (Subscript[C, 2])≤5.340, and with η=0.05, we have  (Subscript[C, 1])≤ 0.506 and (Subscript[C, 2])≤16.989.

First,  we note that the minimum value of (Subscript[C, 1]) is (1/(π  Log[2]))>0.45.

N[(1/(π  Log[2])),10]

This leads to the following upper and lower bounds on N(T,χ).

upper["McCurley",T_,q_]:=Module[{C1,C2,eta},
C1[eta_]=((1+2eta)/(Pi*Log[2]));
C2[eta_]=0.3058-0.268eta+((4Log[Zeta[1+eta]])/(Log[2]))-((2Log[Zeta[2+2eta]])/(Log[2]))+(2/π)Log[Zeta[(3/2)+2eta]];
Floor[(T/π)Log[((q T)/(2π E))]+First[NMinimize[{C1[eta]Log[q T]+C2[eta],0<eta≤1/2},{eta}]]]];
lower["McCurley",T_,q_]:=Module[{C1,C2,eta},
C1[eta_]=((1+2eta)/(Pi*Log[2]));
C2[eta_]=0.3058-0.268eta+((4Log[Zeta[1+eta]])/(Log[2]))-((2Log[Zeta[2+2eta]])/(Log[2]))+(2/π)Log[Zeta[(3/2)+2eta]];
Ceiling[(T/π)Log[((q T)/(2π E))]-First[NMinimize[{C1[eta]Log[q T]+C2[eta],0<eta≤1/2},{eta}]]]];

For low heights, these bounds are very bad. In fact, at T=1, the lower bound is negative!

McCurleyRegion=Show[{Plot[Block[{eta=(1/2) (-1+π C1  Log[2])},0.3058-0.268eta+((4Log[Zeta[1+eta]])/(Log[2]))-((2Log[Zeta[2+2eta]])/(Log[2]))+(2/π)Log[Zeta[(3/2)+2eta]]],{C1,(1/(π Log[2])),(2/(π Log[2]))},AspectRatio->1/3,Filling->Top,FillingStyle->LightBlue, PlotRange->{{0,0.9},{-3.2,20}}],Graphics[Text["McCurley",{0.6,13},{0,0},{2,-1}]]}]

Plot[{lower["McCurley",1,Exp[LogqT]],upper["McCurley",1,Exp[LogqT]]},{LogqT,2,27},PlotLegends->{"lower","upper"},AxesLabel->{"log qT","N(T,chi)"}]

(* NOTE: DirichletCharacters` is O'Bryant's package, thoroughly implementing Conrey's notation for dirichlet characters, available on GitHub. *)
<<DirichletCharacters`
Sum[NumberOfPrimitiveCharacters[q],{q,1,(10^5)}]

How many zeros of height at most 1, and conductor at most (10^5)?

Up to q=9082, the optimal value of η is 1/2.

sum1=Sum[NumberOfPrimitiveCharacters[q]*Floor[(1/π)Log[(q/(2π E))]+((1+2(1/2))/(Pi*Log[2]))Log[q]+(3058/10000)-(268/1000)(1/2)+((4Log[Zeta[1+(1/2)]])/(Log[2]))-((2Log[Zeta[2+2(1/2)]])/(Log[2]))+(2/π)Log[Zeta[(3/2)+2(1/2)]]],{q,1,9082}]

starttime=AbsoluteTime[];
Monitor[sum2=Sum[NumberOfPrimitiveCharacters[q]*Floor[(1/π)Log[(q/(2π E))]+First[FindMinimum[{((1+2eta)/(Pi*Log[2]))Log[q]+0.3058-0.268eta+((4Log[Zeta[1+eta]])/(Log[2]))-((2Log[Zeta[2+2eta]])/(Log[2]))+(2/π)Log[Zeta[(3/2)+2eta]],0<eta≤1/2},{eta},PrecisionGoal->6,WorkingPrecision->MachinePrecision]]],{q,9083,(10^5)}],{ProgressIndicator[q,{9083,(10^5)}],q,(((((AbsoluteTime[]-starttime) ((10^5)-9082))/(q-9082)))-(AbsoluteTime[]-starttime))/60(Quantity[, "min", minutes, "Minutes"])}]

sum1+sum2

The work of Tim Trudgian

The paper
	An Improved Upper Bound for the Error in the Zero-Counting Formulae for Dirichlet L-functions and Dedekind Zeta-Functions, by T. S. Trudgian. Mathematics of Computation, 2014.
contains the following as Theorem 1.

THEOREM 1. Let T≥1 and χ be a primitive nonprincipal character modulo q. Then
	|N(T,χ)-(T/π)log ((q T)/(2π e))| < 0.315 log q T + 6.455.
In addition, if the right side is written as (Subscript[C, 1]) log q T + (Subscript[C, 2]), on may use the values of (Subscript[C, 1]) and (Subscript[C, 2]) contained in Table 1.

c1c2pairs1={{.247,9.359},{.264,8.049},{.281,7.323},{.298,6.828},{.315,6.455},{.332,6.156},{.349,5.907},{.365,5.694},{.382,5.506},{.399,5.338}};
c1c2pairs10={{.247,8.949},{.264,7.640},{.281,6.914},{.298,6.419},{.315,6.046},{.332,5.747},{.349,5.498},{.365,5.284},{.382,5.096},{.399,4.928}};

(* IMPORTANT: These are not proved, as Trudgian has errors. *)
upper["Trudgian",T_,q_]:=Floor[(T/π)Log[((q T)/(2π E))]+If[T≥10,Min[Map[{Log[q T],1}.#&,c1c2pairs10]],Min[Map[{Log[q T],1}.#&,c1c2pairs1]]]];
lower["Trudgian",T_,q_]:=Ceiling[(T/π)Log[((q T)/(2π E))]-If[T≥10,Min[Map[{Log[q T],1}.#&,c1c2pairs10]],Min[Map[{Log[q T],1}.#&,c1c2pairs1]]]];

Sum[upper["Trudgian",1,q]*NumberOfPrimitiveCharacters[q],{q,(10^5)}]

Trudgianpic=Show[McCurleyRegion,Map[Graphics[{Black,Point[#]}]&,Union[c1c2pairs1,c1c2pairs10]],McCurleyRegion,Graphics[Text["Trudgian",{0.35,7.5},{0,0},{4,-1}]],ImageSize->500]

Corollaries of the Main Bound

MainBound[L_]=(22737/100000)L+2Log[1+L]-(1/2);

Corollary  1.2

We need to add (1/4) to Main bound to compensate for removing (Subscript[b, χ]) from the left side. And we use
	Log[q T] == Log[((q (T+2))/(2π))]+Log[2π]-Log[1+(2/T)]==L+Log[2π]-Log[1+(2/T)]

Simplify[Log[q T] -( Log[((q (T+2))/(2π))]+Log[2π]-Log[1+(2/T)]),Assumptions->T≥5/7&&q≥3]

f[{C1_,C2_},L_,T_]=(C1*(L+Log[2π]-Log[1+(2/T)])+C2)-(MainBound[L]+(1/4));
Reduce[D[f[{C1,C2},L,T],L]==0&&C1≥(22737/100000)&&L≥(1567/1000),L]
Reduce[D[f[{C1,C2},L,T],T]≥0&&T≥5/7]

So for a particular  (Subscript[C, 1]),(Subscript[C, 2]), the bound is at its worst with T=(5/7)  and L=((222737-100000 C1)/(-22737+100000 C1)).

N[Block[{C1=(247/1000),C2=(6894/1000)},f[{C1,C2},((222737-100000 C1)/(-22737+100000 C1)),(5/7)]],30]
N[Block[{C1=(298/1000),C2=(4358/1000)},f[{C1,C2},((222737-100000 C1)/(-22737+100000 C1)),(5/7)]],30]
N[Block[{C1=(1/3),C2=(11/3)},f[{C1,C2},((222737-100000 C1)/(-22737+100000 C1)),(5/7)]],30]
N[Block[{C1=(1/4),C2=(20/3)},f[{C1,C2},((222737-100000 C1)/(-22737+100000 C1)),(5/7)]],30]

The bound Log[((q (T+2))/(2π))]≥1.567 implies that Log[q T]≥1.567+Log[2π]-Log[1+(2/T)] , from is equivalent (as q and T  are positive) to
	T≥ 2 ((π/q)(e^1.567)-1).
Under the assumption that q≥12, this is weaker that T≥(5/7). Therefore, we need only to check by hand the L-functions with conductor 3, 4, 5, 7, 8, 9, and 11. And we only need to go up to the height 2 ((π/q)(e^1.567)-1). We go up to height ((2π)/q)(e^6) because that’s our data.

(*PC[q] is a list of primitive characters with conductor q, including 1 from  each conjugate pair *)
PC[q_]:=PC[q]=Select[PrimitiveCharacters[q],ConreyIndex[#]≤ConreyIndex[ConjugateCharacter[#]]&];

AbsoluteTiming[Monitor[Do[PC[q],{q,1,11}],q]]

(* This output should be a list of nonnegative numbers *)
With[{C1=(247/1000),C2=(6894/1000)},
Table[
q=Conductor[char];
{maxheight,zeros}=LSeriesZeroHeights[char];
zeros=Sort[Abs[zeros]];
countofzeros=0;
extremes=Sort[Flatten[Table[
countofzeros++;
{C1 Log[q zeros[[k]]]+C2-Abs[countofzeros-((zeros[[k]] )/π)Log[((q zeros[[k]])/(2 π E))]],C1 Log[q zeros[[k]]]+C2-Abs[countofzeros-1-((zeros[[k]] )/π)Log[((q zeros[[k]])/(2 π E))]]}
,{k,Length[zeros]}]]];
Min[extremes],
{char,Flatten[Table[PC[q],{q,3,11}]]}]]

(* This output should be a list of nonnegative numbers *)
With[{C1=(298/1000),C2=(4358/1000)},
Table[
q=Conductor[char];
{maxheight,zeros}=LSeriesZeroHeights[char];
zeros=Sort[Abs[zeros]];
countofzeros=0;
extremes=Sort[Flatten[Table[
countofzeros++;
{C1 Log[q zeros[[k]]]+C2-Abs[countofzeros-((zeros[[k]] )/π)Log[((q zeros[[k]])/(2 π E))]],C1 Log[q zeros[[k]]]+C2-Abs[countofzeros-1-((zeros[[k]] )/π)Log[((q zeros[[k]])/(2 π E))]]}
,{k,Length[zeros]}]]];
Min[extremes],
{char,Flatten[Table[PC[q],{q,3,11}]]}]]

c1c2pairs1
c1c2pairs10

C2func[C1_]=-f[{C1,0},((222737-100000 C1)/(-22737+100000 C1)),(5/7)];

Newpic=Show[Trudgianpic,Plot[C2func[C1],{C1,(22737/100000),0.9},PlotRange->{{0,0.9},{-3.2,20}},Filling->Top],ListPlot[{{(247/1000),(6894/1000)},{(298/1000),(4358/1000)}}]]

Export[FileNameJoin[{NotebookDirectory[],"Before.pdf"}],Newpic];

<<DirichletCharacters`

a0chars=Sum[NumberOfPrimitiveCharacters[q,0]*0,{q,1,36}]+Sum[NumberOfPrimitiveCharacters[q,0]*1,{q,37,148}]+Sum[NumberOfPrimitiveCharacters[q,0]*2,{q,149,844}]+Sum[NumberOfPrimitiveCharacters[q,0]*5,{q,845,1616}]+Sum[NumberOfPrimitiveCharacters[q,0]*6,{q,1617,6256}]+Sum[NumberOfPrimitiveCharacters[q,0]*7,{q,6257,25252}]+Sum[NumberOfPrimitiveCharacters[q,0]*8,{q,25253,(10^5)}];
a1chars=Sum[NumberOfPrimitiveCharacters[q,1]*0,{q,1,12}]+Sum[NumberOfPrimitiveCharacters[q,1]*1,{q,13,42}]+Sum[NumberOfPrimitiveCharacters[q,1]*2,{q,43,408}]+Sum[NumberOfPrimitiveCharacters[q,1]*3,{q,409,844}]+Sum[NumberOfPrimitiveCharacters[q,1]*5,{q,845,905}]+Sum[NumberOfPrimitiveCharacters[q,1]*6,{q,906,3425}]+Sum[NumberOfPrimitiveCharacters[q,1]*7,{q,3426,55727}]+Sum[NumberOfPrimitiveCharacters[q,1]*8,{q,55728,(10^5)}];
a0chars+a1chars

Main Theorem Bound

From the Main Theorem, N(1,chi) =0 if Log[((q(3))/(2π))]≤1.567, whence N(1,chi)=0 for q≤ 10.

Sum[NumberOfPrimitiveCharacters[q]*Floor[(1/π)Log[(q/(2π E))]+(1/4)+0.22737 Log[((q(3))/(2π))]+2Log[1+Log[((q(3))/(2π))]]-(1/2)],{q,11,(10^5)}]

Lower Bound Computations

Clear[q]

b[a_]=If[a==0,-1/4,1/4];
lower["New",T_,q_,a_]=(T/π)Log[((q T)/(2π E))]+b[a]-MainBound[Log[((q(T+2))/(2π))]]

N[lower["New",1,1.3*(10^47),0],10]
N[lower["New",1,1.3*(10^47),1],10]

N[lower["New",2,1.2*(10^7),0],10]
N[lower["New",2,1.2*(10^7),1],10]