diff options
| author | Scimon <simon.proctor@gmail.com> | 2021-10-25 10:23:27 +0100 |
|---|---|---|
| committer | Scimon <simon.proctor@gmail.com> | 2021-10-25 10:23:27 +0100 |
| commit | 04934952e58ff73537ec24052be6c399748fb015 (patch) | |
| tree | 3d8ad49a75eee96a056ba092d87c36b24c6fcb62 | |
| parent | 9af4627df80018091f1bbf86c07ede1eeeb6548f (diff) | |
| download | perlweeklychallenge-club-04934952e58ff73537ec24052be6c399748fb015.tar.gz perlweeklychallenge-club-04934952e58ff73537ec24052be6c399748fb015.tar.bz2 perlweeklychallenge-club-04934952e58ff73537ec24052be6c399748fb015.zip | |
Challenge 2
| -rw-r--r-- | challenge-136/simon-proctor/raku/ch-2.p6 | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-136/simon-proctor/raku/ch-2.p6 b/challenge-136/simon-proctor/raku/ch-2.p6 new file mode 100644 index 0000000000..da1b3028cb --- /dev/null +++ b/challenge-136/simon-proctor/raku/ch-2.p6 @@ -0,0 +1,15 @@ +#!/usr/bin/env raku + +my %*SUB-MAIN-OPTS = :named-anywhere; + +#| Given an integer N print the number of different combinations of Fibonacci numbers that sum to it. +sub MAIN ( UInt \N, + Bool :v($verbose) = False #= Print the list of values + ) { + my @res = (1,1,*+*...* > N).unique.combinations.grep( + -> @f { ([+] @f) == N } + ); + say @res.elems; + say '---' if $verbose; + (.join(", ").say for @res) if $verbose; +} |
