Created
January 12, 2022 20:08
-
-
Save gfldex/7b2f312317dc7a598c2627367a05f3fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env -S raku --profile=pentathing-profile.html | |
use v6.*; | |
sub is-pentagon($c is raw) { (1+sqrt(1+24*$c))%%6 } | |
sub P($n is raw) { $n*(3*$n-1) div 2 } | |
my atomicint $bail = 0; | |
(^∞).hyper(:batch(64)).map( -> \b { | |
last if $bail; | |
for (1..^b) -> \s { | |
my \bp = P(b); | |
my \sp = P(s); | |
if is-pentagon(bp + sp) && is-pentagon(bp - sp) { | |
say [b, s]; | |
$bail⚛++; | |
say now - BEGIN now; | |
last; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment