#!/usr/bin/perl -w

use Benchmark;

my $num = 0; 
my $rem = 0;
my $halfnum = 0;
my $count = 0;
my $tstart = new Benchmark;

for ($i=$ARGV[0];$i<=$ARGV[1];$i++) {
    $halfnum = sqrt($i+1);
    for ($num = 2;$num<$halfnum;$num++) {
	$rem = $i % $num;# print "$i, $num, $rem\n";
        if ($rem == 0) { 
	    goto over;
	}
    }
    print "$i\n"; $count++;
over:
}

my $tstop = new Benchmark;
my $tdelta = timediff($tstop, $tstart);

print "delta time = ", timestr($tdelta), "\n";
print "count: $count\n";
