Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Created March 23, 2018 15:20
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 dogbert17/750ffbf9fe7022ef091e8172b70779d8 to your computer and use it in GitHub Desktop.
Save dogbert17/750ffbf9fe7022ef091e8172b70779d8 to your computer and use it in GitHub Desktop.
SEGV when profiling
# What 12-digit number do you form by concatenating the three terms in this sequence?
# real 0m1.648s
# user 0m1.576s
# sys 0m0.032s
# This is Rakudo version 2016.04-25-g1512da2 built on MoarVM version 2016.04
use v6;
my @primes = (1001..(10_000 - 3330 * 2 - 1)).grep(-> $n { $n.is-prime && $n != 1487 && ($n + 3330).is-prime && ($n + 6660).is-prime });
my $num = @primes.first(-> $n { ($n + 3330).comb ~~ any($n.comb.permutations) && ($n + 6660).comb ~~ any($n.comb.permutations)});
say $num ~ ($num + 3330) ~ ($num + 6660);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment