(google検索) 44211790234832169331
~~~
http://tech.groups.yahoo.com/group/primeform/message/7618
approimation of the nth prime Topic List
Hi,
Here is an efficient algorithm to compute the nth prime or prime(n). Some
here may be interested.
I first learned of Gram's R(x) = Rg(x) here from David.The output below is
up to prime3(25). The
Gram's Rg(x) was much faster. Taking advantage of the high precision or
Rg(x) to Pi(x) as is shown
in the table, the error for the largest known (10^n)th prime
prime(10^18) = 44211790234832169331 and
prime3(10^18) = 44211790234127235470 is
1.5944476761871074054 E-11
It is interesting that the number of correct places is more for
prime3(10^18) is 1 more than than
Rg(10^18).
Assuming equaliy,
prime3(19) = 465675465111725379481
prime3(20) = 4892055594601460009775
will be correct to 9 and 11 places. Not bad for .gov work!
n Rg(10^n) Pi(10^n) Relative Error
1, 4, 5, -0.1411457852
2, 25, 26, -0.0264653306
3, 168, 168, -0.0021395611
4, 1229, 1227, 0.0016833048
5, 9592, 9587, 0.0004762574
6, 78498, 78527, -0.0003745245
7, 664579, 664667, -0.0001330881
8, 5761455, 5761552, -0.0000168129
9, 50847534, 50847455, 0.0000015452
10,455050683, 455052511, -0.0000040171
11,4118052495, 4118054813, -0.0000005628
12,37607910542, 37607912018, -0.0000000392
13,346065531066, 346065536839, -0.0000000166
14,3204941731602, 3204941750802, -0.0000000059
15,29844570495887, 29844570422669, 0.0000000024
16,279238341360977, 279238341033925, 0.0000000011
17,2623557157055978, 2623557157654233, -0.000000000022
18,24739954284239494, 24739954287740860, -0.000000000014
19,234057667300228940, 234057667276344607, 0.000000000010
20,2220819602556027015,2220819602560918840, -0.00000000000022
The following program makes use of the fact Pi(prime(x)) = x ~ Rg(prime(x))
and that
xlog(x) is a reasonable estimate of prime(x) while for x = 10^n
10^nlog(10^n) is
often a very good estimate of prime(x). The program uses repetitive
bisection of increments to
the exponent shown below. The trials converge to the same accuracy as Rg(x)
is of Pi(x).
primex3(m) = \\Approximation to the (10^n)-th prime
\\ By Cino hilliard
{
local(x,px,r1,r2,r,p10,b,j,e);
b=10;
for(j=1,m,
n=10^j;
p10=log(n)/log(10);
if(Rg(b^p10*log(b^(p10+1)))< b^p10,e=p10+1,e=p10);
r1 = 0;
r2 = 1;
r=(r1+r2)/2;
for(x=1,100,
r=(r1+r2)/2;
px = Rg(b^p10*log(b^(e+r)));
if(px < b^p10,r1=r,r2=r);
r=(r1+r2)/2;
);
print1(j","round(b^p10*log(b^(e+r))));
)
}
Actual data.
n, (10^n)-th prime
1,29
2,541
3,7919
4,104729
5,1299709
6,15485863
7,179424673
8,2038074743
9,22801763489
10,252097800623
11,2760727302517
12,29996224275833
13,323780508946331
14,3475385758524527
15,37124508045065437
16,394906913903735329
17,4185296581467695669
18,44211790234832169331
Calculated data
n prime3(10^n)
1,29
2,536
3,7923
4,104768
5,1299733
6,15484040
7,179431239
8,2038076587
9,22801797576
10,252097715777
11,2760727752353
12,29996225393465
13,323780512411510
14,3475385760290723
15,37124508056355511
16,394906913798224975
17,4185296581676470068
18,44211790234127235470
19,465675465111725379481
20,4892055594601460009775
21,51271091498034649094620
22,536193870744433106620493
23,5596564467987648427919029
24,58310039994835091909014516
25,606527267811196246600510442
Enjoy,
Cino
~~~
http://groups.msn.com/First300billionprimes/primesieve.msnw
~~~
~~~
(google検索)
Cino Hilliard prime
...
end
2008年5月4日日曜日
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿