aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-077/simon-proctor/raku/ch-1.raku15
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;
+ }
+}