aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-125/cheok-yin-fung/perl/ch-1.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/challenge-125/cheok-yin-fung/perl/ch-1.pl b/challenge-125/cheok-yin-fung/perl/ch-1.pl
index 7a700d2ed0..8d0c3a650a 100644
--- a/challenge-125/cheok-yin-fung/perl/ch-1.pl
+++ b/challenge-125/cheok-yin-fung/perl/ch-1.pl
@@ -38,9 +38,9 @@ sub pyth ($n) {
}
- # (C+1)^2 - C^2 = 2C + 1
- # 2C + 1 <= n^2
- # C <= (n^2-1)/2
+ # c^2 - b_max^2 >= (b_max+1)^2 - b_max^2 = 2*b_max + 1
+ # 2*b_max + 1 <= n^2
+ # b_max <= (n^2-1)/2
for my $b0 ($n+1..int ($n*$n-1)/2) {
my $is_sq = $b0*$b0 + $n*$n;