aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-125/dave-jacoby/perl/ch-1.pl18
-rw-r--r--challenge-125/dave-jacoby/perl/ch-2.pl4
2 files changed, 3 insertions, 19 deletions
diff --git a/challenge-125/dave-jacoby/perl/ch-1.pl b/challenge-125/dave-jacoby/perl/ch-1.pl
index 717d608a68..29f99b60d3 100644
--- a/challenge-125/dave-jacoby/perl/ch-1.pl
+++ b/challenge-125/dave-jacoby/perl/ch-1.pl
@@ -65,22 +65,4 @@ sub pt_c ($n ) {
}
return uniq @output if @output;
return undef;
-
- # my @output;
- # my $n2 = $n**2;
-
- # for my $a1 ( 1 .. $n2 ) {
- # my $a2 = $a1**2;
- # for my $b1 ( 1 .. $n2 ) {
- # my $b2 = $b1**2;
- # my $c2 = $a2 + $b2;
- # next if $c2 > $n2;
- # if ( $n2 == $c2 ) {
- # my @x = sort { $a <=> $b } map { int $_ } $a1, $b1, $n;
- # push @output, $json->encode( \@x );
- # }
- # }
- # }
- # return uniq @output if @output;
- # return undef;
}
diff --git a/challenge-125/dave-jacoby/perl/ch-2.pl b/challenge-125/dave-jacoby/perl/ch-2.pl
index b6e5e97817..8dd5fb4268 100644
--- a/challenge-125/dave-jacoby/perl/ch-2.pl
+++ b/challenge-125/dave-jacoby/perl/ch-2.pl
@@ -47,7 +47,9 @@ my $done;
grep { scalar $_->@* == $max }
sort { scalar $b->@* <=> scalar $a->@* } @diameters;
-say join "\n", map { join " ", ( scalar $_->@* ), ':', $_->@* }
+# DIAMETER refers to the edge count, not the node count,
+# so the it's the node count minus one
+say join "\n", map { join " ", ( -1 + scalar $_->@* ), ':', $_->@* }
@diameters;