Find prime n such that reversed n is also prime: Difference between revisions
Content added Content deleted
(→bc: add) |
|||
Line 1,326: | Line 1,326: | ||
found 34 primes |
found 34 primes |
||
done... |
done... |
||
</pre> |
|||
=={{header|RPL}}== |
|||
This program uses the words <code>RVSTR</code> and <code>BPRIM?</code>, respectively made to [[Reverse_a_string#RPL|revert a string]] and to [[Primality_by_trial_division#RPL|test primality by trial division]] |
|||
≪ { } 1 499 '''FOR''' n |
|||
'''IF''' n R→B '''BPRIM? THEN''' |
|||
'''IF''' n →STR '''RVSTR''' STR→ R→B '''BPRIM? THEN''' n + '''END''' |
|||
'''END''' |
|||
'''NEXT''' |
|||
≫ EVAL |
|||
{{out}} |
|||
<pre> |
|||
1: { 2 3 5 7 11 13 17 31 37 71 73 79 97 101 107 113 131 149 151 157 167 179 181 191 199 311 313 337 347 353 359 373 383 389 } |
|||
</pre> |
</pre> |
||