Skip to content

Instantly share code, notes, and snippets.

@MattOates
Created December 15, 2017 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattOates/26f376be0e5a451ae27f1b2e96ff1970 to your computer and use it in GitHub Desktop.
Save MattOates/26f376be0e5a451ae27f1b2e96ff1970 to your computer and use it in GitHub Desktop.
Timking's original elegant attempt at finding primes.
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