diff options
| author | Simon Proctor <simon.proctor@zoopla.co.uk> | 2020-09-07 09:35:24 +0100 |
|---|---|---|
| committer | Simon Proctor <simon.proctor@zoopla.co.uk> | 2020-09-07 09:35:24 +0100 |
| commit | 63afef8b9bfa507fca0fb5a9610a19043ffa14b9 (patch) | |
| tree | e17637dce8c3107c17b144a3ab71a2716abe8856 | |
| parent | 94882719ec2d2ea35cfaf241de7d45b1b2ed1162 (diff) | |
| download | perlweeklychallenge-club-63afef8b9bfa507fca0fb5a9610a19043ffa14b9.tar.gz perlweeklychallenge-club-63afef8b9bfa507fca0fb5a9610a19043ffa14b9.tar.bz2 perlweeklychallenge-club-63afef8b9bfa507fca0fb5a9610a19043ffa14b9.zip | |
Challange one
| -rw-r--r-- | challenge-077/simon-proctor/raku/ch-1.raku | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-077/simon-proctor/raku/ch-1.raku b/challenge-077/simon-proctor/raku/ch-1.raku new file mode 100644 index 0000000000..7d4d1fd09a --- /dev/null +++ b/challenge-077/simon-proctor/raku/ch-1.raku @@ -0,0 +1,15 @@ +#!/usr/bin/env raku + +use v6; + +#| Find the possible combinations of Fibonacci Numbers that add up to N +sub MAIN ( + UInt $N #= Target number +) { + my @combos = (1,1,*+*...^* > $N).unique.combinations.grep( -> @c { $N == [+] @c } ); + if @combos { + (($_.join( " + " ))~" = $N").say for @combos; + } else { + say 0; + } +} |
