diff options
| author | Gurunandan Bhat <gbhat@pobox.com> | 2022-07-30 22:05:40 +0530 |
|---|---|---|
| committer | Gurunandan Bhat <gbhat@pobox.com> | 2022-07-30 22:05:40 +0530 |
| commit | 2d179605c85186f9e296d3e514db3c6f69c62a08 (patch) | |
| tree | 030ffa55d739b12b298621ea33e5d44c34320baf | |
| parent | bd81ae52c10c4ac2f63283dd38b2b396f518df12 (diff) | |
| download | perlweeklychallenge-club-2d179605c85186f9e296d3e514db3c6f69c62a08.tar.gz perlweeklychallenge-club-2d179605c85186f9e296d3e514db3c6f69c62a08.tar.bz2 perlweeklychallenge-club-2d179605c85186f9e296d3e514db3c6f69c62a08.zip | |
Initialize sum of totients to 0, not 1
| -rw-r--r-- | challenge-175/bhat_gurunandan/go/ch-2.go | 2 | ||||
| -rwxr-xr-x | 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))) { |
