Permalink
Browse files

Added prime number test.

  • Loading branch information...
1 parent 09a486c commit 90c48e25080988e421edbd2c364ef7e589d3b3f4 @colomon colomon committed Oct 20, 2010
Showing with 12 additions and 0 deletions.
  1. +12 −0 prime.pl
View
12 prime.pl
@@ -0,0 +1,12 @@
+my sub next-prime(*@primes) {
+ my $i = @primes[*-1];
+ return 3 if $i == 2;
+ loop {
+ $i += 2;
+ return $i unless [||] $i <<%%<< @primes;
+ }
+}
+
+my @primes := 2, 3, &next-prime ... *;
+
+say @primes.munch(100).perl;

0 comments on commit 90c48e2

Please sign in to comment.