Truncatable primes: Difference between revisions

Content added Content deleted
m (Forth - minor edit)
(Added Arturo implementation)
Line 170: Line 170:
Press Enter
Press Enter
</pre>
</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}}==
=={{header|AutoHotkey}}==