Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks in advance,#!/usr/bin/perl use Fcntl qw(LOCK_EX LOCK_NB); flock DATA, LOCK_EX | LOCK_NB or die "Already executing: $!"; my $maxprimes=200; #Stop when you've found this many my $value=1; my $count=0; while ($count < $maxprimes){ $value++; my $composite=0; OUTER: for (my $i=2; $i<$value; $i++){ for (my $j=$i; $j<$value; $j++){ if (($j*$i)==$value){ $composite=1; last OUTER; } } } if (! $composite){ $count++; print "$value "; } } # do not remove this __END__ __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: error message not working
by Arunbear (Prior) on Nov 30, 2004 at 12:09 UTC | |
by bart (Canon) on Nov 30, 2004 at 14:01 UTC | |
by Anonymous Monk on Nov 30, 2004 at 12:18 UTC | |
by Arunbear (Prior) on Nov 30, 2004 at 13:32 UTC | |
|
Re: error message not working
by Happy-the-monk (Canon) on Nov 30, 2004 at 11:57 UTC | |
by rev_1318 (Chaplain) on Nov 30, 2004 at 12:44 UTC | |
|
Re: error message not working
by fglock (Vicar) on Nov 30, 2004 at 11:57 UTC | |
by Anonymous Monk on Nov 30, 2004 at 12:04 UTC | |
by Fletch (Bishop) on Nov 30, 2004 at 12:06 UTC | |
|
Re: error message not working
by ikegami (Patriarch) on Nov 30, 2004 at 18:29 UTC |