Truncatable primes: Difference between revisions

Added PicoLisp
(Ada solution added)
(Added PicoLisp)
Line 227:
>./ step&digits^:5 seed NB. right truncatable
739399</lang>
 
=={{header|PicoLisp}}==
<lang PicoLisp>(load "@lib/rsa.l") # Use the 'prime?' function from RSA package
 
(de truncatablePrime? (N Fun)
(for (L (chop N) L (Fun L))
(T (= "0" (car L)))
(NIL (prime? (format L)))
T ) )
 
(let (Left 1000000 Right 1000000)
(until (truncatablePrime? (dec 'Left) cdr))
(until (truncatablePrime? (dec 'Right) '((L) (cdr (rot L)))))
(cons Left Right) )</lang>
Output:
<pre>-> (998443 . 739399)</pre>
 
=={{header|PowerShell}}==
Anonymous user