diff options
| author | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2021-03-20 15:14:42 +0100 |
|---|---|---|
| committer | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2021-03-20 15:14:42 +0100 |
| commit | a4d9d6b08674e243d74f35ab1fa84bf2a48015af (patch) | |
| tree | d2d2c01fd51c8cb00ccb6121c484c8a5411cca44 | |
| parent | 3368166499ec496ca0a6c8564d0c33f65d4adc07 (diff) | |
| download | perlweeklychallenge-club-a4d9d6b08674e243d74f35ab1fa84bf2a48015af.tar.gz perlweeklychallenge-club-a4d9d6b08674e243d74f35ab1fa84bf2a48015af.tar.bz2 perlweeklychallenge-club-a4d9d6b08674e243d74f35ab1fa84bf2a48015af.zip | |
Note the relation to Fibonacci numbers
| -rwxr-xr-x | challenge-104/jo-37/perl/ch-1.pl | 2 |
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; } |
