aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Sommrey <28217714+jo-37@users.noreply.github.com>2021-03-20 15:14:42 +0100
committerJörg Sommrey <28217714+jo-37@users.noreply.github.com>2021-03-20 15:14:42 +0100
commita4d9d6b08674e243d74f35ab1fa84bf2a48015af (patch)
treed2d2c01fd51c8cb00ccb6121c484c8a5411cca44
parent3368166499ec496ca0a6c8564d0c33f65d4adc07 (diff)
downloadperlweeklychallenge-club-a4d9d6b08674e243d74f35ab1fa84bf2a48015af.tar.gz
perlweeklychallenge-club-a4d9d6b08674e243d74f35ab1fa84bf2a48015af.tar.bz2
perlweeklychallenge-club-a4d9d6b08674e243d74f35ab1fa84bf2a48015af.zip
Note the relation to Fibonacci numbers
-rwxr-xr-xchallenge-104/jo-37/perl/ch-1.pl2
1 files changed, 2 insertions, 0 deletions
diff --git a/challenge-104/jo-37/perl/ch-1.pl b/challenge-104/jo-37/perl/ch-1.pl
index c06ed04f32..1b33496b62 100755
--- a/challenge-104/jo-37/perl/ch-1.pl
+++ b/challenge-104/jo-37/perl/ch-1.pl
@@ -48,6 +48,8 @@ if ($fusc) {
# Non-recursive implementation of fusc according to
# http://oeis.org/A002487
sub fusc ($n) {
+ # Interestingly, without the modulus this would produce the
+ # respective Fibonacci number.
reduce {$a += $b % 2} 0, map binomial($_, $n - $_ - 1),
ceil(($n - 1) / 2) .. $n - 1;
}