You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 14, 2025. It is now read-only.
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.
"""
truncatablePrimes = []
n = 11
while len(truncatablePrimes) < 11:
if isprime(n):
num = str(n)
guilty = False #this is refferring to the "innocent until proven guilty" sentiment,
while len(num) > 1 and not guilty: #and has no real meaning code-wise, other than continuing with operations until its true.
num = num[1:] #It was just all I could think about at the moment.