Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Created January 27, 2020 16: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 dogbert17/9e039d6af26a09e144f144b4e0aba220 to your computer and use it in GitHub Desktop.
Save dogbert17/9e039d6af26a09e144f144b4e0aba220 to your computer and use it in GitHub Desktop.
my int $j = 2;
my int $cnt = 0;
my int $mult = 2;
CNT:
loop (;;)
{
$mult +<= 1;
# my $x = Str($mult);
my $x = ~$mult;
if $x.chars() == 16 {
$mult div= 10;
}
if $x.starts-with("123") {
last CNT if ++$cnt >= 678910;
# say("Found $cnt => $j") if $cnt +& 1023 == 0; # this is slow
}
++$j;
}
say("Found $cnt => $j");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment