Emirp primes: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (Added Arturo implementation) |
|||
Line 214: | Line 214: | ||
emirp 10000: 948349 |
emirp 10000: 948349 |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<lang rebol>emirps: function [upto][ |
|||
result: new [] |
|||
loop range .step: 2 11 upto 'x [ |
|||
if prime? x [ |
|||
reversed: to :integer reverse to :string x |
|||
if x <> reversed [ |
|||
if prime? reversed -> |
|||
'result ++ x |
|||
] |
|||
] |
|||
] |
|||
return result |
|||
] |
|||
lst: emirps 1000000 |
|||
print "The first 20 emirps:" |
|||
print first.n: 20 lst |
|||
print "" |
|||
print "Emirps between 7700 and 8000:" |
|||
print select lst 'x -> and? x > 7700 x < 8000 |
|||
print "" |
|||
print "The 10000th emirp:" |
|||
print lst\9999</lang> |
|||
{{out}} |
|||
<pre>The first 20 emirps: |
|||
13 17 31 37 71 73 79 97 107 113 149 157 167 179 199 311 337 347 359 389 |
|||
Emirps between 7700 and 8000: |
|||
7717 7757 7817 7841 7867 7879 7901 7927 7949 7951 7963 |
|||
The 10000th emirp: |
|||
948349</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |