$\# \{\text{primes}\ 4n+3 \le x\}$ in terms of $\text{Li}(x)$ and roots of Dirichlet $L$-functions

In a paper about Prime Number Races, I found the following (page 14 and 19):

This formula, while
widely believed to be correct, has not yet been proved.
$$
\frac{\int\limits_2^x{\frac{dt}{\ln t}} – \# \{\text{primes}\le
x\} }
{\sqrt x/\ln x} \approx 1 + 2\sum_{\gamma} \ \ \frac{\sin(\gamma\ln x)}{\gamma},
\tag{3}
$$
with $\gamma$ being imaginary part of the roots of the $\zeta$ function.

$\dots$

For example, if the Generalized Riemann Hypothesis is
true for the function $L(s)$ just defined, then we get the formula
$$
\frac{\#\{\text{primes}\ 4n+3 \le x\} – \#\{\text{primes}\ 4n+1
\le x\}} {\sqrt x/\ln x} \approx 1 + 2\sum_{\gamma^\prime}
\frac{\sin(\gamma^\prime\ln x)}{\gamma^\prime}, \tag{4′}
$$
with $\gamma^\prime$ being imaginary part of the roots of the Dirichlet $L$-function associated to the race between primes of
the form $4n+3$ and primes of the form $4n+1$, which is
$$
L(s) = \frac1{1^s} – \frac1{3^s} + \frac1{5^s} – \frac1{7^s} + \dots.
$$

  1. Since
    $$
    \begin{eqnarray}
    \# \{\text{primes}\le x\} &=&\# \{\text{primes}\ 4n+3 \le x\} + \#\{\text{primes}\ 4n+1\le x\}\\
    &\approx& \text{Li}(x)- \left(\sqrt x/\ln x\right) \left(1 + 2\sum_{\gamma} \ \ \frac{\sin(\gamma\ln x)}{\gamma} \right)
    \end{eqnarray}
    $$
    and assuming the (Generalized) Riemann Hypothesis to be true, is it valid to calculate
    $$
    \begin{eqnarray}
    \# \{\text{primes}\ 4n+3 \le x\} &\approx& \frac{\text{Li}(x)}{2} &-& \frac{\left(\sqrt x/\ln x\right)}{2} \left(1 + 2\sum_{\gamma} \ \ \frac{\sin(\gamma\ln x)}{\gamma} \right)\\
    &&&+& \frac{\left(\sqrt x/\ln x\right)}{2} \left( 1 + 2\sum_{\gamma^\prime}
    \frac{\sin(\gamma^\prime\ln x)}{\gamma^\prime} \right)\\
    &\approx& \frac{\text{Li}(x)}{2} &+& \left(\sqrt x/\ln x\right) \left(\sum_{\gamma^\prime}
    \frac{\sin(\gamma^\prime\ln x)}{\gamma^\prime} -\sum_{\gamma} \ \ \frac{\sin(\gamma\ln x)}{\gamma} \right),
    \end{eqnarray}
    $$
    or do the error terms spoil the calculation?

  2. Is there another way to get $\# \{\text{primes}\ 4n+3 \le x\}$ using a different Dirichlet $L$-function? How does it look like? Is it possible to treat the general case of $\# \{\text{primes}\ kn+m \le x\}$ the same way?

EDIT From the wiki page on Generalized Riemann hypothesis (GRH), I get:

Dirichlet’s theorem states that if a and d are coprime natural numbers, then the arithmetic progression a, a+d, a+2d, a+3d, … contains infinitely many prime numbers. Let π(x,a,d) denote the number of prime numbers in this progression which are less than or equal to x. If the generalized Riemann hypothesis is true, then for every coprime a and d and for every ε > 0
$$
\pi(x,a,d) = \frac{1}{\varphi(d)} \int_2^x \frac{1}{\ln t}\,dt + O(x^{1/2+\epsilon})\quad\mbox{ as } \ x\to\infty
$$
where φ(d) is Euler’s totient function and O is the Big O notation. This is a considerable strengthening of the prime number theorem.

So my example would look like
$$
\pi(x,3,4) = \frac{1}{\varphi(4)}\text{Li}(x) + O(x^{1/2+\epsilon}),
$$
(something that already ask/answered here: Distribution of Subsets of Primes). So the part with the roots seems to be burried in $O(x^{1/2+\epsilon})$, since $\varphi(4)=2$.

Thanks…

Solutions Collecting From Web of "$\# \{\text{primes}\ 4n+3 \le x\}$ in terms of $\text{Li}(x)$ and roots of Dirichlet $L$-functions"

(1) is a correct computation. In general, to treat primes of the form $kn+m$, you would have a linear combination of $\phi(k)$ sums, each of which runs over the zeros of a different Dirichlet $L$-function (of which the Riemann $\zeta$ function is a special case). And yes, assuming the generalized Riemann hypothesis, all of the terms including those sums over zeros can be estimated into the $O(x^{1/2+\epsilon})$ term.

To find out more, you want to look for “the prime number theorem for arithmetic progressions”, and in particular the “explicit formula”. I know it appears in Montgomery and Vaughan’s book, for example.

Here is how far I got with an explicit formula for the number of primes of the form $4n+3$ below $x$, $\pi^*(x;4,3)$, expressed in terms of (sums of) sums of Riemann’s $R$ functions over roots of Riemann’s $\zeta$ resp. Dirichlet $\beta$ function:

\begin{align*}
\Pi^*(x;4,3)
&= \pi^*(x;4,3) + \tfrac12 \sum_{\substack{b\pmod 4 \\ b^2\equiv
3\pmod 4}} \pi^*(x^{1/2};4,b) + \tfrac13 \sum_{\substack{c\pmod q \\
c^3\equiv 3\pmod 4}} \pi^*(x^{1/3};4,c) + \cdots \\
\end{align*}
Then I try to complete things by adding several up

\begin{align*}
\Pi^*(x;4,3) &= \tfrac11\pi^*(x;4,3) + \tfrac13 \pi^*(x^{1/3};4,3) + \cdots \\
\tfrac12\Pi^*(x^{1/2};4,3) &= \tfrac12\pi^*(x^{1/2};4,3) + \tfrac16
\pi^*(x^{1/6};4,3) + \cdots \\
\tfrac14\Pi^*(x^{1/4};4,3) &= \tfrac14\pi^*(x^{1/4};4,3) +
\tfrac1{12} \pi^*(x^{1/12};4,3) + \cdots \\
&\vdots&\\
\hline\\
\tag{1}\sum_{k=0}^\infty
2^{-k}\Pi^*(x^{2^{-k}};4,3)&=\sum_{m=1}^\infty \tfrac1m
\pi^*(x^{1/m};4,3)
\end{align*}
Using Möbuis inversion I’ll get

\begin{align*}
\pi^*(x;4,3)&=\sum_{m=1}^\infty \tfrac{\mu(m)}m\sum_{k=0}^\infty
2^{-k}\Pi^*(x^{2^{-k}/m};4,3)\\
\tag{2}&=\sum_{k=0}^\infty 2^{-k}\sum_{m=0}^\infty
\tfrac{\mu(m)}m\Pi^*(x^{2^{-k}/m};4,3)
\end{align*}
Now I use

\begin{align*}
\Pi^*(x^{2^{-k}};4,3)&=\frac1{\phi(4)} \sum_{\chi\pmod 4}
\overline{\chi(3)}\Pi^*(x^{2^{-k}},\chi)\\
\tag{3}&=\frac12 \left( \Pi^*(x^{2^{-k}},\chi_1)-
\Pi^*(x^{2^{-k}},\chi_2) \right)
\end{align*}
and then

\begin{align*}
\tag{$4_1$}\Pi^*(x^{2^{-k}},\chi_k)&=\operatorname{li}(x^{1/2^{k}})-\sum_{\rho_\zeta}
\operatorname{li}(x^{\rho_\zeta/2^k})\text{ if $k=1$}\\
\tag{$4_2$}&=\phantom{\operatorname{li}(x^{1/2^{k}})}-\sum_{\rho_\beta}
\operatorname{li}(x^{\rho_\beta/2^k})\text{ if $k=2$}\\
\end{align*}
which gives

\begin{align*}
\tag{3′}\Pi^*(x^{2^{-k}};4,3)&=\frac12 \left(
\operatorname{li}(x^{1/2^{k}})-\sum_{\rho_\zeta}
\operatorname{li}(x^{\rho_\zeta/2^k}) +\sum_{\rho_\beta}
\operatorname{li}(x^{\rho_\beta/2^k}) \right)
\end{align*}
so finally

\begin{align*}
\pi^*(x;4,3)&=\sum_{k=0}^\infty 2^{-k}\sum_{m=0}^\infty
\tfrac{\mu(m)}m\frac12 \left(
\operatorname{li}(x^{1/2^{k}})-\sum_{\rho_\zeta}
\operatorname{li}(x^{\rho_\zeta/2^k}) +\sum_{\rho_\beta}
\operatorname{li}(x^{\rho_\beta/2^k}) \right)\\
\tag{5}&=\sum_{k=0}^\infty 2^{-k-1}\left(
\operatorname{R}(x^{1/2^{k}})-\sum_{\rho_\zeta}
\operatorname{R}(x^{\rho_\zeta/2^k}) +\sum_{\rho_\beta}
\operatorname{R}(x^{\rho_\beta/2^k}) \right)
\end{align*}

I would be very, very glad to read your opinion…

UPDATE: The point of this answer is to visualize your exact formula for the prime counting function restrained to primes $\equiv 3 \bmod 4$. The sums over $\rho_\zeta$ and over $\rho_\beta$ are over all the zeros of the Riemann-$\zeta$ and Dirichlet-$\beta$ functions respectively sorted by increasing absolute imaginary part :
$$\pi_{Dr}(x):=\sum_{k=0}^\infty\;2^{-k-1}\left(
\operatorname{R}\left(x^{1/2^{k}}\right)-\sum_{\rho_\zeta}
\operatorname{R}\left(x^{\rho_\zeta/2^k}\right) +\sum_{\rho_\beta}
\operatorname{R}\left(x^{\rho_\beta/2^k}\right) \right)-1$$

(I subtracted $1$ at the end as found necessary by this other derivation using your nice telescoping method)

The plot of the approximation obtained by truncating the infinite series to their first terms (the parameters used are indicated at the end) is compared to the exact (darker) formula for $\pi_{4,3}(x)$ with $x\in (4,150)$ (the picture may be zoomed) :

comparison over 4-150

Such a picture doesn’t constitute a proof but merits my sincere < Felicitations !>


To let you play with your function I included my scripts. They require two precomputed tables of zeros of zeta and beta. I used Andrew Odlyzko’s fine table of zeta zeros and the beta zeros came from my older answer here. These tables should be formated as $[v_1, v_2,\cdots,v_n]$ on one line or
$[v_1\,,\backslash$
$\;v_2\,,\backslash$
$\cdots,\backslash$
$\;v_n\,]$

The $\operatorname{Ei}$ (exponential integral) function uses continued fractions for large imaginary parts of $z$ and the built-in function elsewhere (the last one should suffice once corrected in pari). The partial Riemann function $\operatorname{R}$ uses $\,\operatorname{lx}=\log x$ as parameter instead of $x$ and we are comparing the classical $\pi_{4,3}(x)$ function to your exact function $\pi_{Dr}(x)$. More exactly to the partial sum obtained by using only the $n$ first terms of $\operatorname{R}()$, the $r$ first complex roots of $\zeta$ and $\beta$ and the $p$ first powers of $2$ (sum over $k$) from your exact formula.

// pari/gp scripts //
\r zeta.gp
tz=%;
\r beta.gp
tb=%;

;Ei(z)=-eint1(-z)+Pi*I*sign(imag(z))  ;correct formula provisory replaced by :
Ei(z)=if(abs(imag(z))<20,Pi*I*sign(imag(z))-incgam(0,-z),local(n=5+round(1000/(abs(imag(z))+1e-8)),r=-z);forstep(k=n,1,-1,r=-z+k/(1+k/r));-exp(z)/r)+Pi*I*sign(imag(z))
R(n,lx)=sum(k=1,n,moebius(k)*Ei(lx/k)/k)
pi43(x)=local(c=0);forprime(p=3,x,if(p%4==3,c++));c
piDr(n,r,p,x)=local(lx=log(x));sum(k=0,p,2^(-k-1)*(R(n,1/2^k*lx)+2*sum(i=1,r,-R(n,(1/2+tz[i]*I)/2^k*lx)+R(n,(1/2+tb[i]*I)/2^k*lx))))-1

// 'short' session using these functions //
> pi43(100)
= 13
> piDr(20,100,6,100)
= 13.640816983 + 0.6262904416*I
> ploth(x=4,150,[real(pi43(x)),real(piDr(20,330,10,x))],,146)

Here is a table of the 331 first zeros for numerical evaluation
(warning: values could be missing…)

6.0209489046975966549025115255,
10.243770304166554552137757473,
12.988098012312422507453109785,
16.342607104587222194976861486,
18.291993196123534838526004279,
21.450611343983460497200948384,
23.278376520459531531819558882,
25.728756425088727567265088675,
28.359634343025327785651607948,
29.656384014593152721809906963,
32.592186527117155130815194045,
34.199957509213146913044795479,
36.142880458303137830565814472,
38.511923141718691293776504680,
40.322674066690544180344394367,
41.807084620004562337157521896,
44.617891058662303393482045721,
45.599584396791566745937702295,
47.741562280939141250781347344,
49.723129323782586066569570883,
51.686093452870528439533811111,
52.768820767804729265035076579,
55.267543584699224846718259652,
56.934374055202296886801711960,
58.116707110673917977262367546,
60.421713949007834673018618295,
62.008632285767769451930615509,
63.714641118785433123518297959,
64.976170573095999348605924739,
67.636920863546068398054991150,
68.365884503834422961233738148,
70.185879908802112061371282120,
72.155484974381881214691542592,
73.767635521485893336154626169,
75.143121647433111405798000424,
76.696303203430199064566659967,
78.809998314320913003691783203,
80.210131238366638915148032664,
81.213951626883151157734833354,
83.666656014470571651283310367,
84.731740363781628608217577601,
86.577660168390264410210548722,
87.629718119587899689039432381,
89.801131616695811325969388292,
91.349703814697573473931013977,
92.237499910454258046004175773,
94.166619585960021307053060933,
96.136011161780558185274479276,
96.961741579417483577607743327,
98.755300415754527668603973554,
100.13488670306768529019231904,
102.14138082688961382675997843,
103.28807538167900270159333920,
104.33326984426745450495085217,
106.69445890889584172960040021,
107.69020697514670020812946699,
110.49960817642909478048490816,
112.36781674401217995716661013,
113.81479554899267353956309211,
116.19320465846121898963013972,
118.53755437884686165780011347,
119.45298987620909035824186237,
120.73129361866037693368487739,
122.44746137906871191967947661,
123.79454876031950609879380618,
125.76851955991559376249639951,
126.29877602494140909790014712,
127.95940768306329938305588877,
129.88562335864546932623503678,
131.09357875408399607523436803,
132.14357660098782788050132120,
133.74418146397481319142376707,
135.49083725255700224755404510,
136.54731226728255838933127345,
138.45729450969625766509038076,
138.75017770461144012954768949,
141.25363250975178412806669861,
142.39441752219778229834700120,
143.32906274161773201159359077,
144.97816627771136218178674826,
146.52200528490833848995838351,
147.93453081218091703481025120,
150.29635900154312145801640888,
151.96198767048369072791846343,
153.69961262351526052550597524,
154.57549142871991733629296692,
155.65024866324343586811534637,
157.74830530790292831907457397,
158.70502112552935112493067703,
160.23648409677104233377768408,
161.40714697615670734528135116,
162.56604668959903962627418377,
164.73116461657689691990755216,
165.40141928586315409461482322,
166.75387916910842711467929232,
168.04442078170974462074284599,
170.05113118752669021484810142,
170.73476699457880545645576325,
172.28048177162133811838196765,
173.44297883613501571697079678,
174.91508808540057340441548453,
176.59730214191806744299558376,
177.70121257457377580802426815,
178.36237490898565560941206095,
180.56931038528553139779449794,
181.61491373170438998090812364,
182.91676832896896722720668364,
184.11503237536838876567103733,
185.37399660770047491721481058,
187.06876059069440954145591925,
188.27137433227075068590376587,
189.49173149212854251358185449,
190.37118761075577274333641876,
192.36113787605631840741605201,
193.79707292614668099455436082,
194.23188322936089922195285019,
196.13200565468428482335296831,
197.11344622157640853776338155,
198.80647573614690671134916226,
200.16203942869863020720223578,
200.90161787076887940260335396,
202.26057799593173083976534604,
204.22107078015820641522076416,
204.99200345509828370916637889,
206.41191104761124331431101684,
207.31737748188785830627423332,
209.22775249264801305239596646,
210.10318551739854017072638068,
211.83341182042389919211672672,
212.53760753721342419767373639,
213.76184210127810212713458895,
215.79381838201559960577042888,
216.70341526620296547634366018,
217.58193141803801709611175843,
220.40562171063697515795993634,
221.92854850725447804914936995,
223.00310318062916135528239779,
224.12223848794683215004758755,
225.29326147520535806546186025,
226.98818848837537471961421291,
228.40550629743637922559802583,
228.95902363267523675101910098,
230.33013057780480230594069311,
232.10048174706901195203683135,
233.04806374529880402510570392,
234.35178770183278559126691643,
235.83621877114146878871598106,
236.24156049447563754765718358,
238.53711304998262144198336571,
239.33848813561967049191160837,
240.62671116939306732194741836,
241.47792092821119586131445270,
243.22893117973858440259094571,
244.51316858358815891067982334,
245.56488138011395915721891054,
246.72405853472513520671442287,
247.99511858273842666345737680,
249.18450896488545637926359681,
251.08656315045619512213120503,
251.63691583961430554302515677,
252.62344577966837570410866022,
254.31443735012273900901544828,
255.83791804974205189835948383,
256.50458494734840573390589089,
258.16526285035121855236577743,
258.83447052352496550977190962,
260.43047213492557515755933298,
261.91361498764980573464503310,
262.88361734246063150509166818,
264.05425788812825390396163665,
264.93285914122008364534327761,
267.00065119971523220684196260,
267.80144698460232962989982417,
268.78330606204792631747966001,
270.27808716748190417041357469,
271.25498369444883796265227849,
272.75587860169341823184636255,
274.17145831251909085018642460,
275.03310123658021403265232025,
275.85894601108307686333373631,
277.77232263831925417841397013,
278.80368388728653858809887697,
280.15714487097460512335476030,
280.79310694940911465165921265,
282.37964046356129969375983170,
283.60454343388307793996827161,
284.92559582341671675890997136,
286.08023330771695304124563007,
287.14942464824185193072788536,
287.97847626332132927976356976,
290.25214699517454327999080838,
290.67729632326071525164544826,
291.83202458884475548513071512,
293.20243417747287711021312313,
294.32726845145976737666041017,
295.80347082471925776988952183,
296.90066613885493288162667737,
298.07887411489226009930190937,
298.87032030707756002676910778,
300.43445985053453461820420384,
301.91984252859711814323532054,
302.91793758311719513681600129,
303.66111804033389116484131301,
305.06520886541900440815050046,
306.79513396371212102425959963,
307.28608493671484668789621993,
309.12248303042252096412050493,
309.73990761397483015859790586,
310.82367496094542226066492277,
312.55636686756100688064634699,
313.87794245506793787784240517,
314.43316516928890292103837772,
315.73498612492696188725190719,
317.01231804223259726515461799,
318.45621725635502024358202211,
319.57969129703539985620862417,
320.40630364449298983627652971,
322.00196780449032992290146609,
322.53911742379191664486892560,
324.51844467372429468247621743,
325.47478404410633875373192686,
326.45854121986539504473910264,
327.25993176651157705164654818,
329.20009793757918038019912741,
330.03604959034586362558252897,
331.21140289958185800530565896,
332.57294652823343974554556525,
333.18150832869444693922851618,
334.76869989467941751441968305,
336.15271755443328443350210094,
337.13966305477713627524956702,
338.22628268603666690396333911,
339.01125261519977890816451524,
340.84195235235292162066710614,
342.02615318336469741374106741,
342.68585823735877067928271577,
344.0836661565686862627004762,
345.2097753413459573044110626,
346.2627604671016941476647978,
347.9246481143632697374566129,
348.9817983885468120149499228,
349.4343424566002814630006007,
350.9772131093086171005228543,
352.3917682431248441639303136,
353.6933333256829546124685137,
354.3017377414641314355505898,
355.7444402625970306431358347,
356.6276472137673985753141096,
358.2882750929424366211009481,
359.0964611926055643566214138,
360.7110410245589243479893582,
361.1974930362084806074524790,
362.2769688931667497705396854,
364.4197244318352155945317356,
364.8037360921119966497987857,
366.0496895182690012543463580,
367.1255349350747462262053663,
368.4338148898077761672916077,
369.5016933318964405363710183,
371.0690160905648737699591025,
371.7700959151502466275535791,
372.8848608865911226393246899,
373.9348689154616523799502265,
375.5468747270075926960247017,
376.6839009379746539367477905,
377.5592232741848044307652399,
378.3869290457616630146695094,
380.0570731823139939966249588,
381.0486701230352553532850229,
382.2397664190157338254422377,
383.4850923542027975470084695,
384.3728456816805919723012968,
385.2152276718100110520672671,
387.1492092876308094595627758,
388.0821424777153497850755292,
388.7777179618526297788291030,
390.1691126288973758248577388,
391.0819257199607056364820762,
392.8517629133617494151722895,
393.4434077110107140920915261,
394.8199970917935633992004384,
395.8046096034178296276558608,
396.7344554225485063080197069,
398.2504159767379466957124019,
399.5655109221428371501170699,
400.6928757687115794343838349,
400.8264309422547318135722239,
402.8183184588996972949913858,
403.9074050434836080884771320,
404.9455862206118613759957847,
406.1612477978882182837592234,
407.1450155618871805968322187,
408.0395266729539842871170633,
409.5882131208357647653279288,
410.8716628634833972562447402,
411.6605714508530686255969330,
412.7311469575827245352595916,
413.6692853952956581370774306,
415.4292958729206053433345755,
416.3705912266159986762147974,
417.1292702136133141970538904,
418.5574767268274943568745235,
419.4874594223070529595380503,
420.5289538979833121243014068,
422.5103730295799395812912385,
422.6872546051342268536572665,
424.0668954927375279116779846,
424.8233888200049631864585039,
426.7324170086494599710725394,
427.3840178113418017106211713,
428.6981079540674684462150564,
429.5893859724852216637696316,
430.6175578358959205969367714,
432.0607725159701751635973864,
433.0374431195775491061980546,
434.4393523989532303725779273,
435.3481541603433508857855094,
435.9041636774496664998333698,
437.5822193991931840771232678,
439.1581082551973744286998591,
439.5375694451764723240134399,
440.6772278998545002559418857,
442.1697399171824047073380865,
442.7770442912218304593990887,
444.4382905078887461488730008,
445.4637391684133745717113130,
446.4483316219370803911040887,
447.3020089048109206937709813,
448.5069310886578395843178830,
450.0566203069175123775802095,
451.0707759054247023168568904