Special neighbor primes: Difference between revisions
Content added Content deleted
No edit summary |
(add RPL) |
||
Line 1,036: | Line 1,036: | ||
Found 13 special neighbor primes |
Found 13 special neighbor primes |
||
done... |
done... |
||
</pre> |
|||
=={{header|RPL}}== |
|||
{{works with|HP|49}} |
|||
≪ → max |
|||
≪ <span style="color:red">{ } 3 5</span> |
|||
'''DO''' |
|||
'''IF''' DUP2 + <span style="color:red">1</span> - ISPRIME? '''THEN''' DUP2 R→C <span style="color:red">4</span> ROLL SWAP + UNROT '''END''' |
|||
NIP DUP NEXTPRIME |
|||
'''UNTIL''' OVER max < OVER max < AND '''END''' |
|||
DROP2 |
|||
≫ ≫ '<span style="color:blue">SNP</span>' STO |
|||
100 <span style="color:blue">SNP</span> |
|||
{{out}} |
|||
<pre> |
|||
1: { (3.,5.) (5.,7.) (7.,11.) (11.,13.) (13.,17.) (19.,23.) (29.,31.) (31.,37.) (41.,43.) (43.,47.) (61.,67.) (67.,71.) (73.,79.) } |
|||
</pre> |
</pre> |
||
Line 1,057: | Line 1,074: | ||
[73, 79] |
[73, 79] |
||
</pre> |
</pre> |
||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
<syntaxhighlight lang="ruby">func special_neighbor_primes(upto) { |
<syntaxhighlight lang="ruby">func special_neighbor_primes(upto) { |