The number 3797 is a truncatable prime: left-to-right truncation yields 3797, 797, 97, 7 (all prime), and right-to-left yields 3797, 379, 37, 3 (all prime). Given count N, find the sum of the first N truncatable primes (from both left to right and right to left). Single-digit primes are not considered truncatable.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= N <= 11
Tags:
