aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-076/markus-holzer/raku/ch-1.raku13
-rw-r--r--challenge-076/markus-holzer/raku/ch-2.raku6
2 files changed, 16 insertions, 3 deletions
diff --git a/challenge-076/markus-holzer/raku/ch-1.raku b/challenge-076/markus-holzer/raku/ch-1.raku
new file mode 100644
index 0000000000..9741904c25
--- /dev/null
+++ b/challenge-076/markus-holzer/raku/ch-1.raku
@@ -0,0 +1,13 @@
+my $N = 1528;
+
+my @primes = (2..^$N)
+ .grep( *.is-prime );
+
+my @candidates = @primes X @primes;
+
+my @solutions = @candidates
+ .grep( *.sum == $N )
+ .map( *.sort.cache )
+ .unique( with => &[~~] );
+
+.say for @solutions; \ No newline at end of file
diff --git a/challenge-076/markus-holzer/raku/ch-2.raku b/challenge-076/markus-holzer/raku/ch-2.raku
index f097c62e5d..5847a91ed5 100644
--- a/challenge-076/markus-holzer/raku/ch-2.raku
+++ b/challenge-076/markus-holzer/raku/ch-2.raku
@@ -1,7 +1,7 @@
unit sub MAIN($words-file, $board-file);
my @words = $words-file.IO.lines;
-my @board = $board-file.IO.slurp.subst( ' ',:g ).lines;
+my @board = $board-file.IO.slurp.subst( ' ', :g ).lines;
my $width = @board.head.chars;
my @chars = @board.map: |*.comb;
@@ -11,7 +11,7 @@ sub words-in( $text ) {
$text ~'~'~ $text.flip ~~ m:ex:i/@words/ }
sub rotated-data {
- @chars.batch( $width ), |( (0,0),(0,1),(1,0) ).map: &rotate-data }
+ @chars.batch( $width ), |( (0,0), (0,1), (1,0) ).map: &rotate-data }
sub rotate-data( @offsets ) {
- (^$width).map: { @chars[ ($_ + @offsets[0]), ($_ + $width + @offsets[1]) ... * ] } } \ No newline at end of file
+ (^$width).map: { @chars[ ($_ + @offsets[0]), ($_ + $width + @offsets[1]) ... * ] } }