Posts

Showing posts with the label problem 37

Truncatable primes | Project Euler | Problem #37

URL to the problem page:  https://projecteuler.net/problem=37 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 the only eleven primes that are both truncatable from left to right and right to left. NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes. #include   <iostream> using   namespace   std ; int   power ( int   a ,  int   b ) {      int  result =  1 ;      for  ( int  i =  0 ; i < b; i++) {         result = result * a;     }      return  result; } int   finddigits ( int   a )...
My photo
Ercan Tomac
instagram.com/ercantomac