Minimum primes: Difference between revisions

Content added Content deleted
No edit summary
(→‎{{header|Raku}}: Add a Raku example)
Line 21: Line 21:
</lang>{{out}}
</lang>{{out}}
<pre>[43; 101; 79; 59; 67;;]</pre>
<pre>[43; 101; 79; 59; 67;;]</pre>


=={{header|Raku}}==
Seems kind of pointless to specify a maximum of 5 terms when there are only 5 elements in each list but... ¯\_(ツ)_/¯

<lang perl6>say ([Zmax] <5 45 23 21 67>, <43 22 78 46 38>, <9 98 12 54 53>)».&next-prime[^5];

sub next-prime { ($^m..*).first: &is-prime }</lang>
{{out}}
<pre>(43 101 79 59 67)</pre>