Skip to content

Instantly share code, notes, and snippets.

@colomon
Created October 13, 2010 13:57
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 colomon/624075 to your computer and use it in GitHub Desktop.
Save colomon/624075 to your computer and use it in GitHub Desktop.
sub is-prime($a) {
return Bool::True if $a == 2;
! [||] $a <<%%<< (2, 3, *+2 ... * > $a.sqrt);
}
my @fib := (1, 1, *+* ... *);
my $least-prime = (@fib ... { $^a > 227000 && is-prime($a) })[*-1];
my $x = $least-prime + 1;
say [+] (2, 3, *+2 ... * > $x.sqrt).grep({ $x %% $^a && is-prime($a) });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment