Sum of primes in odd positions is prime: Difference between revisions
Sum of primes in odd positions is prime (view source)
Revision as of 14:54, 1 September 2021
, 2 years ago→{{header|Raku}}: Added Raku solution
mNo edit summary |
(→{{header|Raku}}: Added Raku solution) |
||
Line 71:
143 823 26,879
</pre>
=={{header|Raku}}==
<lang perl6>my @odd = grep { ++$ !%% 2 }, grep &is-prime, 2 ..^ 1000;
my @sums = [\+] @odd;
say .fmt('%5d') for grep { .[1].is-prime }, ( @odd Z @sums );</lang>
{{out}}
<pre>
2 2
5 7
31 89
103 659
149 1181
331 5021
467 9923
499 10909
523 11941
653 17959
823 26879</pre>
=={{header|Ring}}==
|