aboutsummaryrefslogtreecommitdiff
path: root/challenge-076
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-09-04 01:28:34 +0100
committerGitHub <noreply@github.com>2020-09-04 01:28:34 +0100
commit8680c92f98daa5529442efb788258bd97d80d89b (patch)
tree366031d3a52d289351d75b7a7c7eab299a6a121a /challenge-076
parent12ff3549dfb90710fe6d447eb6d1b9b9273df9b6 (diff)
parent320384f8f628d11f7bc330ad494b80ef20a241b6 (diff)
downloadperlweeklychallenge-club-8680c92f98daa5529442efb788258bd97d80d89b.tar.gz
perlweeklychallenge-club-8680c92f98daa5529442efb788258bd97d80d89b.tar.bz2
perlweeklychallenge-club-8680c92f98daa5529442efb788258bd97d80d89b.zip
Merge pull request #2198 from holli-holzer/master
initial
Diffstat (limited to 'challenge-076')
-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]) ... * ] } }