Skip to content

Commit

Permalink
Solves the printing problem #95
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Jan 22, 2023
1 parent 9747384 commit e4b179f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions categories/euler/prob009-gerdr.raku
Expand Up @@ -38,9 +38,9 @@ The condition a < b gives the constraint
a < (1 - 1/√2)·N
=end pod

constant \SQRT2 = sqrt(0.5);
sub triples($N) {
for 1..Int((1 - sqrt(0.5)) * $N) -> $a {
for 1..Int((1 - SQRT2) * $N) -> $a {
my $u = $N * ($N - 2 * $a);
my $v = 2 * ($N - $a);

Expand All @@ -49,11 +49,11 @@ sub triples($N) {
if $u %% $v {
my $b = $u div $v;
my $c = $N - $a - $b;
take $($a, $b, $c);
return ($a, $b, $c);
}
}
}

say [*] .list for gather triples(1000);
say triples(1000);

# vim: expandtab shiftwidth=4 ft=perl6

0 comments on commit e4b179f

Please sign in to comment.