100% Guaranteed Results


Project
$ 24.99
Category:

Description

5/5 – (1 vote)

This problem is a programming version of Problem 37 from projecteuler.net
The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.
Find the sum of primes that are both truncatable from left to right and right to left below N.
NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.
Input Format
Input contains an integer N.
Output Format
Print the answer corresponding to the test case.
Constraints
100≤N≤106
Sample Input

Sample Output

Reviews

There are no reviews yet.

Be the first to review “Project”

Your email address will not be published. Required fields are marked *

Related products