Truncatable primes: Difference between revisions
Content deleted Content added
→{{header|Python}}: Add comments |
→{{header|Python}}: first draft |
||
Line 5:
C.f: [[Sieve of Eratosthenes]]; [http://mathworld.wolfram.com/TruncatablePrime.html Truncatable Prime] from Mathworld.
== {{header|J}} ==
<lang j> isprime=: 1&p:
filterprimes=: #~ isprime
primesbelow=: filterprimes@i.@-
isprimeRT=: ([: *./@:isprime 0&".\)@":"0
isprimeLT=: ([: *./@:isprime 0&".\.)@":"0
({~ i.&1@:isprimeLT) primesbelow 1e6
999907
({~ i.&1@:isprimeRT) primesbelow 1e6
739399</lang>
== {{header|Python}} ==
|