aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-149/luca-ferrari/raku/ch-1.p613
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-149/luca-ferrari/raku/ch-1.p6 b/challenge-149/luca-ferrari/raku/ch-1.p6
new file mode 100755
index 0000000000..2282387013
--- /dev/null
+++ b/challenge-149/luca-ferrari/raku/ch-1.p6
@@ -0,0 +1,13 @@
+#!raku
+
+sub MAIN( Int $N where { $N > 0 } ) {
+ my @fibonacci = 1, 1, * + * ... *;
+ my $fibonacci-index = $N;
+ my @numbers = lazy gather {
+ for 0 .. Inf -> $i {
+ take $i and $fibonacci-index += $N if @fibonacci[ 0 .. $fibonacci-index ].grep( $i.split( '' ).sum );;
+ }
+ };
+
+ @numbers[ 0 .. $N - 1 ].join( ',' ).say;
+}