Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
its a program that should list the first 1000 prime numbers, but it dsntmy (@primes, $i); for(@primes=(2), $i=3 ;scalar(@primes) < 1000 ;$i++) {foreach my $p (@primes){ if ($i % $p == 0){ $i++ } } push @primes, $i; } print ("@primes");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Prime list
by LanX (Saint) on Feb 08, 2015 at 22:05 UTC | |
by AnomalousMonk (Archbishop) on Feb 08, 2015 at 22:45 UTC | |
by LanX (Saint) on Feb 08, 2015 at 22:49 UTC | |
by AnomalousMonk (Archbishop) on Feb 08, 2015 at 23:05 UTC | |
by QM (Parson) on Feb 09, 2015 at 11:04 UTC | |
|
Re: Prime list
by kroach (Pilgrim) on Feb 08, 2015 at 22:24 UTC | |
|
Re: Prime list
by Discipulus (Canon) on Feb 09, 2015 at 08:29 UTC | |
by danaj (Friar) on Feb 12, 2015 at 17:19 UTC |