Truncatable primes: Difference between revisions

Added Arturo implementation
m (Forth - minor edit)
(Added Arturo implementation)
Line 170:
Press Enter
</pre>
 
=={{header|Arturo}}==
 
<lang rebol>leftTruncatable?: function [n][
every? map 0..(size s)-1 'z -> to :integer slice s z (size s)-1
=> prime?
]
 
rightTruncatable?: function [n][
every? map 0..(size s)-1 'z -> to :integer slice s 0 z
=> prime?
]
 
upperLimit: 999999
 
loop range upperLimit .step:2 0 'x [
s: to :string x
if and? not? contains? s "0"
leftTruncatable? x [
print ["highest left-truncatable:" x]
break
]
]
 
loop range upperLimit .step:2 0 'x [
s: to :string x
if and? not? contains? s "0"
rightTruncatable? x [
print ["highest right-truncatable:" x]
break
]
]</lang>
 
{{out}}
 
<pre>highest left-truncatable: 998443
highest right-truncatable: 739399</pre>
 
=={{header|AutoHotkey}}==
1,532

edits