Sequence of primes by trial division: Difference between revisions
Content added Content deleted
(add RPL) |
|||
Line 2,920: | Line 2,920: | ||
return true |
return true |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|RPL}}== |
|||
<code>PRIM?</code> is defined at [[Primality by trial division#RPL|Primality by trial division]] |
|||
≪ { } 2 ROT '''FOR''' n |
|||
'''IF''' n <span style="color:blue">PRIM?</span> THEN n + '''END''' |
|||
'''NEXT''' |
|||
≫ '<span style="color:blue">PRIMES</span>' STO |
|||
50 <span style="color:blue">PRIMES</span> |
|||
{{out}} |
|||
<pre> |
|||
1: { 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 } |
|||
</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |