Created
October 4, 2021 11:51
-
-
Save gugod/5be1cae591e6a6edc9d8d970b89a2e6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env raku | |
sub postfix:<!>( Int $n ) { [*] (1..$n) } | |
sub prefix:<Σ>( *@nums ) { [+] @nums } | |
sub compute_this (Int $n) { | |
Σ (0..$n).map( | |
-> $r { | |
$n! / ($r! * ($n - $r)!) | |
} | |
) | |
} | |
say compute_this(9); | |
say compute_this(10); | |
say compute_this(11); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment