Solution for truncatable primes. relatively optimized.