Skip to content

Instantly share code, notes, and snippets.

@zoffixznet

zoffixznet/p6.p6 Secret

Last active July 1, 2018 23:19
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 zoffixznet/fbd3578cc9e2d75d9b7daae6b83c1b31 to your computer and use it in GitHub Desktop.
Save zoffixznet/fbd3578cc9e2d75d9b7daae6b83c1b31 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl6
my @primes;
PRIME: loop (my $n = 2; $n <= 10_000; $n++) {
next PRIME if $n %% $_ for @primes;
@primes.push: $n;
}
my $time = now - ENTER now;
say "Found {+@primes} primes in {$time}s ({round(+@primes / $time)} P/s)";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment