![]() |
|
|
#1 |
|
Jan 2005
Minsk, Belarus
24·52 Posts |
Hello people :-)
While compiling the tables of the prime-counting function and its fluctuations, I realized that it's possible to set up a distributed project to sieve all the primes up to, say, 1018, and maybe further. Tomás Oliveira e Silva used a segmented sieve and reached 1.6*1018 within ~400 CPU years. Unfortunately, Tomás recorded the prime counts only every 1012. But these results could be used for double-checking. I propose to save the prime counts every 109. For the range of 1018 it will take 109 data points. To save the space, we could record the difference pi(x)-li(x) multiplied by 2 (to get rid of roundoff errors) and rounded to the nearest integer. It will take just 4 bytes for each such point. Moreover, it seems that the difference between two adjacent points never exceeds 215 by the absolute value, so only 2 last bytes could be stored. There's an example of such a database for the range up to 1014: http://www.primefan.ru/stuff/primes/pi.dat (200 000 bytes) It takes only a few seconds to sieve the subrange of 5*108, so, having the database, one could quickly compute the value of pi(x) for any x within the range. The database could be hosted on the web. * * * * * * Well, the main idea is to implement the siever which could be used by, for example, BOINC contributors. Maybe it has sense to use CUDA there? The sieving routines should be parallelizable this way, I think... However, my programming skills are too low for this; you may just look over my simple implementation of the classical sieve up to 1015, which takes over 1 minute (!) at 1GHz for the subrange of 109: http://www.primefan.ru/stuff/soft/siever.txt With best regards, Andrey V. Kulsha |
|
|
|
|
|
#2 |
|
Banned
"Luigi"
Aug 2002
Team Italia
12D316 Posts |
Hello Andrey!
You are talking about small primes, that could be proven in milliseconds. A friend of mine wrote an assembly program for MS-DOS that calculated prime numbers in the first 232 naturals in 3 seconds on 20 MHz machines. The question is: is it worth it? ![]() Who will be in charge to update 1018 values into the database? Luigi |
|
|
|
|
|
#3 |
|
A Sunny Moo
Aug 2007
USA (GMT-5)
3×2,083 Posts |
PrimeGrid did a project sort of like this a while back with their now-defunct "Primegen" subproject; I'm not sure what method they used or how far they got, though they hit it with enough resources that I wouldn't be surprised if they got much farther 1018.
Edit: I just checked and it seems they stopped at 640,000,000,000, which is somewhere between 232 and 233. See this thread in their forum for more info. Last fiddled with by mdettweiler on 2010-02-28 at 01:03 |
|
|
|
|
|
#4 |
|
Jun 2003
5,087 Posts |
Nobody's talking about storing primes -- only prime counts.
|
|
|
|
|
|
#5 |
|
"Mark"
Apr 2003
Between here and the
22·7·227 Posts |
I'm not understanding the usefullness of this.
|
|
|
|
|
|
#6 | |
|
Jan 2005
Minsk, Belarus
24×52 Posts |
Quote:
Where did you see 1018 values? :surprised Last fiddled with by XYYXF on 2010-02-28 at 08:06 |
|
|
|
|
|
|
#7 |
|
Dec 2008
179 Posts |
That seems to be an extremely slow way to compute pi(x). Best known methods are much faster, and don't require a huge database.
|
|
|
|
|
|
#8 | |
|
"Robert Gerbicz"
Oct 2005
Hungary
2×743 Posts |
Quote:
As far as I know Mathematica is also using precomputed table and sieve to compute pi(x). |
|
|
|
|
|
|
#9 |
|
Jan 2005
Minsk, Belarus
24×52 Posts |
|
|
|
|
|
|
#10 |
|
"Mark"
Apr 2003
Between here and the
22·7·227 Posts |
So one has a database filled with pi(x) for many values of x. Again, what is the value of that?
|
|
|
|
|
|
#11 | |
|
Account Deleted
"Tim Sorbera"
Aug 2006
San Antonio, TX USA
10000101010112 Posts |
http://primes.utm.edu/nthprime/ goes up to 10^12. Do you really need any more? If so, it might be helpful to take some hints on how they did it (look at "Algorithm" on that page).
Quote:
On an Athlon 2400XP with 1.5GB RAM, it took 88 minutes and 41 seconds to search all numbers up to 40 billion (about 10*2^32). Guesstimating a linear scaling, it could probably do up to 2^32 in about 8-9 minutes. Not bad, but not 3 seconds on a 20 MHz machine. Last fiddled with by Mini-Geek on 2010-02-28 at 15:05 |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sieve of Eratosthenes | bhelmes | Number Theory Discussion Group | 43 | 2018-03-13 01:04 |
| New GPU accelerated sieve of Eratosthenes | cseizert | Programming | 8 | 2016-10-27 05:55 |
| Sieve of Eratosthenes | Raman | Programming | 4 | 2009-01-19 17:12 |
| Sieve of Eratosthenes | jchein1 | Homework Help | 6 | 2007-08-27 13:51 |
| Prime in Riesel Sieve Project | Sloth | Prime Sierpinski Project | 1 | 2006-05-10 02:02 |