Created
December 15, 2017 21:22
-
-
Save MattOates/26f376be0e5a451ae27f1b2e96ff1970 to your computer and use it in GitHub Desktop.
Timking's original elegant attempt at finding primes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub primes-any (Int $max) { | |
my Int @primes; | |
@primes.push($_) unless $_ %% any(@primes) for 2 .. $max; | |
return @primes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment