We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- All Contests
- ProjectEuler+
- Project Euler #37: Truncatable primes
Project Euler #37: Truncatable primes
Project Euler #37: Truncatable primes
Contest ends in
This problem is a programming version of Problem 37 from projecteuler.net
The number has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: , , , and . Similarly we can work from right to left: , , , and .
Find the sum of primes that are both truncatable from left to right and right to left below .
NOTE: , , , and are not considered to be truncatable primes.
Input Format
Input contains an integer .
Constraints
Output Format
Print the answer corresponding to the test case.
Sample Input
100
Sample Output
186