Minimum primes: Difference between revisions

add RPL
No edit summary
(add RPL)
Line 621:
</pre>
 
=={{header|RPL}}==
====By the letter====
{{works with|HP|49g}}
≪ {5 45 23 21 67} {43 22 78 46 38} {9 98 12 54 53} → numbers1 numbers2 numbers3
≪ numbers1 numbers2 numbers3 3 ≪ MAX MAX ≫ DOLIST
{ } → max primes
≪ 1 max SIZE '''FOR''' j
max j GET
'''IF''' DUP ISPRIME? NOT '''THEN''' NEXTPRIME '''END'''
'primes' SWAP STO+
'''NEXT''' primes
≫ ≫ ≫ '<span style="color:blue">TASK</span>' STO
{{out}}
<pre>
1: {43 101 79 59 67}
</pre>
====Idiomatic====
No need for local variables.
≪ {5 45 23 21 67} {43 22 78 46 38} {9 98 12 54 53}
3 ≪ MAX MAX ≫ DOLIST
≪ '''IF''' DUP ISPRIME? NOT '''THEN''' NEXTPRIME '''END''' ≫ MAP
≫ '<span style="color:blue">TASK</span>' STO
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">require "prime"
Line 631 ⟶ 653:
<pre>[43, 101, 79, 59, 67]
</pre>
 
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">var lists = [
1,150

edits