Jump to content

Minimum primes: Difference between revisions

→‎{{header|Raku}}: Add a Raku example
No edit summary
(→‎{{header|Raku}}: Add a Raku example)
Line 21:
</lang>{{out}}
<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>
 
 
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.