[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Prime Numbers



> (Does it do the first 1000 primes *correctly*?  If not, then the time to
> produce the first 1000 primes is infinite, and speeding it up would be done
> first by making it correct.)
>

Are you suggesting they are not correct???

>
>>my $idx;
>>
>>while (++$_) {
>> print "",
>>  (((1x $_) !~ /^(11+)\1+$/) ? "Yes $_ is prime; found " .++$idx." numbers"
>>: next ),
>> "\n";
>>}


I have verified that the first 1,000 are prime. I ran it on a MacOS 300MHZ
Laptop and under the same with LinuxPPC - 30 seconds faster.
I ran it on a UltraSparc (production WWW server) took about 5 minutes...

Other test machines to follow:
300MHz MacOS Desktop,
333 "  Ultrasparc 10 (PCI) Desktop,
233 "  BeOS (Intel),
250 "  PPC (MacOS, BeOS, LinuxPPC) (I think it's an 8500,
            but I need to dig it out of the closet... :)

Keep ya posted,
-Sneex- :]

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org