<commit_before>def is_number_prime(number_to_check):
    is_prime = True
    # I'm staring with the no.2, because we already know that no.1 isn't prime, because it can only divided by itself
    for numberToDivideBy in range(2, number_to_check):
        # use modulo to see if there is a remainder.
        # if the remainder is zero, then the number is NOT prime
        if number_to_check % numberToDivideBy == 0:
            is_prime = False
            break  # no need to continue checking all the other numbers
    return is_prime


########################################################################################################################
# assume the number is prime. if its got a remainder after being divided by something, then its not prime
for numberToCheck in range(1, 10000):
    the_number_is_prime = is_number_prime(numberToCheck)

    if the_number_is_prime:
        print("%d is prime" % numberToCheck)<commit_msg>added prime number optimisation<commit_after>import time


def now():
    return time.time() * 1000.0


start = now()
optimise = True
list_primes = []


def is_number_prime(the_number_to_check):
    is_prime = True
    if optimise:
        # justin says this is faster
        nums_to_divide_by = list_primes
    else:
        # Im staring with the no.2, because we already know that no.1 isn't prime, because it can only divided by itself
        nums_to_divide_by = range(2, the_number_to_check)

    for number_to_divide_by in nums_to_divide_by:
        # use modulo to see if there is a remainder.
        # if the remainder is zero, then the number is NOT prime
        if the_number_to_check % number_to_divide_by == 0:
            is_prime = False
            break  # no need to continue checking all the other numbers
    return is_prime


########################################################################################################################
# assume the number is prime. if its got a remainder after being divided by something, then its not prime
for number_to_check in range(2, 10000):
    the_number_is_prime = is_number_prime(number_to_check)

    if the_number_is_prime:
        list_primes.append(number_to_check)


print("Here are the prime numbers:")
print(list_primes)
print("Took %d milliseconds" % (now() - start))
{'fraction_non_alphanumeric': 0.15832970856894302, 'fraction_numerical': 0.01087429317094389, 'mean_word_length': 3.6558704453441297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6904982', 'n_tokens_mistral': 661, 'n_tokens_neox': 619, 'n_words': 232}