From 2d179605c85186f9e296d3e514db3c6f69c62a08 Mon Sep 17 00:00:00 2001 From: Gurunandan Bhat Date: Sat, 30 Jul 2022 22:05:40 +0530 Subject: Initialize sum of totients to 0, not 1 --- challenge-175/bhat_gurunandan/go/ch-2.go | 2 +- challenge-175/bhat_gurunandan/perl/ch-2.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/challenge-175/bhat_gurunandan/go/ch-2.go b/challenge-175/bhat_gurunandan/go/ch-2.go index 70b380283b..2537c559fd 100644 --- a/challenge-175/bhat_gurunandan/go/ch-2.go +++ b/challenge-175/bhat_gurunandan/go/ch-2.go @@ -49,7 +49,7 @@ func main() { for len(perfect) < max { - sum, iter := 1, this + sum, iter := 0, this for iter > 1 { if cache[iter] == 0 { diff --git a/challenge-175/bhat_gurunandan/perl/ch-2.pl b/challenge-175/bhat_gurunandan/perl/ch-2.pl index ff0b2c0a69..b936f8ef45 100755 --- a/challenge-175/bhat_gurunandan/perl/ch-2.pl +++ b/challenge-175/bhat_gurunandan/perl/ch-2.pl @@ -40,7 +40,7 @@ my $this = 2; while (@perfect < $MAX) { - my $sum = 1; + my $sum = 0; my $totient = $this; while ($totient = ($cache {$totient} //= totient ($totient))) { -- cgit