[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

812.0. "How many primes < 2^32 ?" by SMURF::JMARTIN (Joseph A. Martin, ULTRIX kernel) Wed Jan 06 1988 11:46

I make it 203,280,221.  I am testing a Sieve-of-Eratosthenes program to be
used for various pedagogical and benchmarking purposes.  If you look up the
answer, please cite your source.  If you compute it, I'd be curious to know
what language you used and how long the program ran on what hardware running
what operating system.  Thanks.
--Joe
T.RTitleUserPersonal
Name
DateLines
812.1Same AnswerTALLIS::STEELYThu Jan 07 1988 09:1711
I happened to have been playing around with a prime number program a while
back.  

Starting with 2 as the first prime number I also get 203,280,221 prime numbers
less than 2^32.  I stopped my program with the first prime greater than
2^32, which is 2^32+15.

My program is written in Ada.  I ran it last night on a VAXstation 2000 running
VMS V4.6 and it took 15 hours 22 minutes and 18.91 seconds of CPU time.

						Simon
812.2Same ballpark, that's reassuringSMURF::JMARTINJoseph A. Martin, ULTRIX kernelMon Jan 11 1988 11:184
Thanks, Simon.  Using C (compiled with vcc) and a little assembly (for
zeroing out the sieve), it took my microVAX II and ULTRIX v2.2 9.48 hours
of CPU time and 9.75 of wall clock time.
--Joe
812.3Algorithm details?JON::MORONEYRedundancy example: Criminal lawyer.Tue Jan 12 1988 17:405
re .*:

Did you use a 2^32 bit sieve for this or did you use some method to fold it?

-Mike
812.4My approachTALLIS::STEELYTue Jan 12 1988 21:2817
Here's a real short story of what I believe my program is doing.  I
haven't looked at in quite a while.

My program uses either an 8K or 16K sieve of longwords.  For each 
sieve-writing pass, I write the pass-number into the longwords which are
multiples of primes.   After marking all multiples of primes, the sieve is
examined and all entries which don't match the present pass are primes.

I also have a steps array that is modulo 2*3*5*7*11*13 that controls 
the examination of entries in the sieve to only numbers that aren't
already divisible by one of those primes.

Since Joe has reported a faster program I'm going to spend some time
one of these weekends and look at unrolling my sieve writing loop
and see if I can get an Ada program to match his times.

					Simon
812.5Before you unroll...SMURF::JMARTINJoseph A. Martin, ULTRIX kernelWed Jan 13 1988 10:2112
My sieve is folded into 4-million-byte sections each representing 8 million
consecutive odd integers.  The table of times (in seconds) seems to
indicate that memory access dominates.  Put another way, I'm not using
cache or write buffers to any advantage.  Consequently, I was considering
getting my sieve sections down under the cache size for an 8650 or 8700
to see if that helps.

    35096.5 real     33757.8 user       388.9 sys  eldrad (microVAX II)
    12853.2 real     12722.0 user        32.9 sys  hollow (VAX 8650)
    34089.0 real     34071.5 user        10.9 sys  halted (VAX 8300)

--Joe
812.6send me a copyDPDMAI::FRAMELIFri Apr 01 1988 06:337
    i would be very interested in getting a copy of the benchmarks you
    
    have for computing prime numbers. 
    
    
    dale
    frameli.dale @dpd