Easy: give the task to a faster machine. ;-) As to your real question: I don't know. (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.) --John At 13:49 -0400 8/13/99, Bill Jones wrote: >The following determines if a number is prime (I got it from an Abby .sig a >while back; he makes the greatest one liners :) However, it takes about 6 >minutes to calculate the first 1,000 prime numbers - > >my $idx; > >while (++$_) { > print "", > (((1x $_) !~ /^(11+)\1+$/) ? "Yes $_ is prime; found " .++$idx." numbers" >: next ), > "\n"; >} > >Can anyone speed it up? -- John Baxter jwblist@olympus.net Port Ludlow, WA, USA ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org