# How accurately must I compute the twin prime constant to get the twin prime density?

Let $$\pi _{2}(x)$$ denote the number of primes $$p\leq x$$ such that $$p+2$$ is also prime. Hardy and Littlewood conjectured that

$${\displaystyle \pi _{2}(x)\sim 2C_{2}{\frac {x}{(\ln x)^{2}}}\sim 2C_{2}\int _{2}^{x}{dt \over (\ln t)^{2}}},$$

where

$${\displaystyle C_{2}=\prod _{\textstyle {p\;{\rm {prime}} \atop p\geq 3}}\left(1-{\frac {1}{(p-1)^{2}}}\right)\approx 0.660161815846869573927812110014\dots }.$$

I want to numerically study this density, so I implemented some C++ code that computes the above value for $$\pi_2(x)$$. However, before launching any computations I want to make sure that I set everything up correctly. In particular, I am unsure about what precision I should use for $$C_2$$, i.e., the twin-prime constant, in function of my input $$x$$.

In other words, how many primes should I include within the product for $$C_2$$ so that I get the correct expected conjectured density for $$\pi_2(x)$$? For example, if I want to calculate the conjectured density for $$\pi_2(10^5)$$, should I include all primes $$\leq 10^5$$ in the product for $$C_2$$?

• The number of digits of $C_2$ given in the problem will be more than accurate enough for any $x$ you can reach numerically. Sub-leading terms in the asymptotic form are going to contribute much earlier than the 30th significant figure. Commented Dec 3, 2018 at 15:49
• @mjqxxxx Thank you for your comment. Can you give a more detailed answer, in terms of $x$? For instance, how many primes should I consider in the product for $\pi_2(10^x)$? Commented Dec 3, 2018 at 19:16

Calculations using Wolfram Alpha give $$C_2(1000)=0.66017,\quad C_2(10000) = 0.660162,\quad C_2(100000) = 0.660162.$$ I think this gives information about accuracy.
On the other hand, $$\int_2^x \dfrac{dt}{\ln^2 t} = \mathrm{li}(x) - \mathrm{li}(2) - \dfrac x{\ln x} + \dfrac 2{\ln2}$$ (see also Wolfram Alpha).
• Thank you for your answer. However, I fail to see how this answers my question: " how many primes should I include within the product for C2 so that I get the correct expected conjectured density for $π2(x)$"; in function of $x$? Commented Dec 8, 2018 at 9:02
• If I want to calculate the conjectured density for $π_2(10^5)$, should I include all primes $≤10^5$ in the product for $C_2$? Commented Dec 8, 2018 at 11:53