Help for this page

Select Code to Download


  1. or download this
    #!perl
    
    ...
     2, 3, 5, 7, 11, 13, 17, 19, 
    );
    
  2. or download this
    # primep($x) returns whether $x is a prime
    sub primep_rm {
    ...
     }
     return 1;
    }
    
  3. or download this
    
    # powmod($a, $f, $m) calculates $a**$f % $m,
    ...
    }
    my $greatest_prime_squared = $primes[-1]**2;
    
  4. or download this
    sub primep_div {
     my $cand = 0 + $_[0];
    ...
     }
     die "internal error: shouldn't fall through here";
    }
    
  5. or download this
    
    }
    ...
    
    
    __END__
    
  6. or download this
    begin serial tests at p line 125.
    begin random tests at p line 129.
    ...
               s/iter  primep_rm primep_div
    primep_rm    3.41         --       -30%
    primep_div   2.37        44%         --