OFFSET
1,1
COMMENTS
a(10) = 6100475249386 has relative 0.000000698 error from the actual value 6100479510551.
LINKS
Cino Hilliard, Counting and summing primes
Thomas R. Nicely, Enumeration of twin primes less than 1e16
FORMULA
Pi2(n) = number of twin primes <= n.
Twinpi(n) = number of twin prime pairs < n
Li_2(n)=intnum(t=2,n,2*c_2/log(t)^2)
The relationship n = Pi2(twinpi(n)) is used with a bisection routine where
Pi2(n) is the Hardy-Littlewood integral approximation for number of twin
primes
PROG
(PARI) g(n) = {
print1(floor(twinx2(10)), ", ");
for(x=2, n, y=twinx(10^x); print1(floor(y)", "))
}
twinx(n) =
{
local(r1, r2, r, est);
r1 = n;
r2 = n*n;
for(x=1, 100,
r=(r1+r2)/2.;
/*Hardy-Littlewood integral approximation for pi_2(x).*/
est = Li_2(r);
if(est <= n, r1=r, r2=r);
);
r;
}
twinx2(n) =
{
local(x, tx, r1, r2, r, pw, b, e, est);
if(n==1, return(3));
b=10;
pw=log(n)/log(b);
m=pw+1;
r1 = 0;
r2 = 7.213;
for(x=1, 100,
r=(r1+r2)/2;
est = b^(m+r);
tx = Li_2(est);
if(tx <= b^pw, r1=r, r2=r);
);
est;
}
Li_2(x)=intnum(t=2, x, 2*0.660161815846869573927812110014555778432623/log(t)^2)
CROSSREFS
KEYWORD
nonn
AUTHOR
Cino Hilliard, Oct 29 2008
STATUS
approved