<commit_before># Truncatable primes from left to right ---> 
#Ex: 3797 ~ 797 ~ 97 ~ 7 and 3797 ~ 379 ~ 37 ~ 3 ##

import math
import timeit


start = timeit.default_timer()

def is_prime(x):
    if x == 2: 
        return True
    if x % 2 == 0 or x == 1:
        return False
    for i in xrange(3, int(math.sqrt(x)) + 1, 2):
        if x % i == 0:
            return False
    return True

def euler_37():
    return sum([p for p in [i for i in xrange(11, 1000000) if is_prime(i) and not set(str(i)).intersection(['0', '4', '6', '8'])] if all([is_prime(int(str(p)[:-v])) for v in xrange(1, len(str(p)))]) and all([is_prime(int(str(p)[v:])) for v in xrange(1, len(str(p)))])])

print "Answer: %s" % euler_37()
stop = timeit.default_timer()
print "Time: %f" % (stop - start)<commit_msg>no need to create lists<commit_after># Truncatable primes from left to right ---> 
# Ex: 3797 ~ 797 ~ 97 ~ 7 and 3797 ~ 379 ~ 37 ~ 3 

import math
import timeit


start = timeit.default_timer()

def is_prime(x):
    if x == 2: 
        return True
    if x % 2 == 0 or x == 1:
        return False
    for i in xrange(3, int(math.sqrt(x)) + 1, 2):
        if x % i == 0:
            return False
    return True

def euler_37():
    return sum([p for p in (i for i in xrange(11, 1000000) if is_prime(i) and not set(str(i)).intersection(['0', '4', '6', '8'])) if all(is_prime(int(str(p)[:-v])) for v in xrange(1, len(str(p)))) and all(is_prime(int(str(p)[v:])) for v in xrange(1, len(str(p))))])

print "Answer: %s" % euler_37()
stop = timeit.default_timer()
print "Time: %f" % (stop - start)
{'fraction_non_alphanumeric': 0.17755231452124287, 'fraction_numerical': 0.05960684844641725, 'mean_word_length': 3.046153846153846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3078482', 'n_tokens_mistral': 682, 'n_tokens_neox': 599, 'n_words': 203}