Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: The sieve of Xuedong Luo (Algorithm3) for generating prime numbers

by danaj (Friar)
on Jun 13, 2015 at 07:02 UTC ( [id://1130278]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl bin/algorithm3.pl 1_000_000_000
    Prime numbers : 50847534
    Compute time  : 0.163 sec
    ...
    perl -Mntheory=:all -E 'say prime_count(1e9)'
    50847534
    0.020s user time
    
  2. or download this
    perl bin/algorithm3.pl 4_294_967_296 --sum
    Sum of primes : 425649736193687430
    Compute time  : 1.222 sec
    ...
    perl -Mntheory=:all -E 'my $s=0; forprimes { $s+=$_ } 2**32; say $s'
    425649736193687430
    11.198s user time
    
  3. or download this
    perl bin/algorithm3.pl 4_294_967_296 --print >/dev/null
    Compute time  : 3.279 sec
    
    ...
    
    primesieve -p1 2**32 >/dev/null
    172.9s user time
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1130278]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2024-04-24 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found