Truncatable primes: Difference between revisions
Content deleted Content added
Line 826:
step=: selPrime@,@:(,&.":/&>)@{@;</lang>
Here, selPrime discards non-prime numbers from a list, so seed is the list 2 3 5 7.
The largest truncatable primes less than a million can be obtained by adding five digits to the prime seeds, then finding the largest value from the result:▼
▲The largest truncatable primes less than a million can be obtained by adding five digits to the prime seeds, then finding the largest value from the result
<lang j> >./ digits&step^:5 seed NB. left truncatable
Line 832 ⟶ 834:
>./ step&digits^:5 seed NB. right truncatable
739399</lang>
Note that we are using the same combining function and same basic procedure in both cases. The difference is which side of the number we add arbitrary digits to, for each step.
=={{header|Java}}==
|