Friday 12 April 2013

C/C++ Program to Print Truncatable Primes

  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. Remember 2, 3, 5, and 7 are not considered to be Truncatable Primes. The C/C++ Program in this post prints Truncatable Primes truncatable from both left and right. 

Figure Below Shows a Sample Output

No comments:

Post a Comment