Find prime n such that reversed n is also prime: Difference between revisions

Added 11l
(Add Cowgol)
(Added 11l)
Line 4:
Find prime &nbsp; '''n''' &nbsp; &nbsp; for &nbsp; '''0 < n < 500''' &nbsp; &nbsp; which are also primes when the (decimal) digits are reversed.
<br><br>
 
=={{header|11l}}==
<lang 11l>F is_prime(a)
I a == 2
R 1B
I a < 2 | a % 2 == 0
R 0B
L(i) (3 .. Int(sqrt(a))).step(2)
I a % i == 0
R 0B
R 1B
 
L(n) 1..499
I is_prime(n) & is_prime(Int(reversed(String(n))))
print(n, end' ‘ ’)</lang>
 
{{out}}
<pre>
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>
 
=={{header|Action!}}==
1,463

edits