Help for this page

Select Code to Download


  1. or download this
    k = 3 - k;
    
  2. or download this
    /* Sieve of Eratosthenes.  Return a reference to an array containing a
    +ll
     * prime numbers less than or equal to search_to.  Uses an optimized s
    +ieve
    ...
              av_push( av, newSVuv( static_cast<unsigned long>( i ) ) );
        return newRV_noinc( (SV*) av );
    }
    
  3. or download this
    /* Sieve of Xuedong Luo (Algorithm3). Return a reference to an array
     * containing all prime numbers less than or equal to search_to.
    ...
    
        return newRV_noinc( (SV*) av );
    }
    
  4. or download this
    my $primes = primes( 1_000_000_000 );
    
    ...
    
    There are 50,847,534 prime numbers between 1 and 1 billion.
    
  5. or download this
    #
    # Count primes
    ...
    
    perl primeutil.pl  4_294_967_296 --print >/dev/null
    Compute time  : 13.470 sec
    
  6. or download this
    Count primes
    
    ...
       $ perl primeutil.pl 4294967296 --print >/dev/null
       Compute time  : 1.925 sec