<commit_before>#!/usr/bin/env python2
###############################################################################
#
# Sieve of Eratosthenes Implementation.
#
# Implementation based on the optimized implementation pseudocode provided on
# Wikipedia: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
# Copyright (C) 2014, <NAME> (100437638)
# All rights reserved.
#
###############################################################################

from math import ceil, sqrt
A = [True] * 29

for i in xrange(2, int(ceil(sqrt(30)))+1):
    if A[i-2]:
        for k in xrange(0, 30+1):
            j = i**2 + k*i
            if j > 30:
                break
            A[j-2] = False

for i in xrange(0, len(A)):
    if A[i]:
        print i+2<commit_msg>Cleaned up code, use a function to return list of primes<commit_after>#!/usr/bin/env python2
###############################################################################
#
# Sieve of Eratosthenes Implementation.
#
# Implementation based on the optimized implementation pseudocode provided on
# Wikipedia: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
# Copyright (C) 2014, <NAME> (100437638)
# All rights reserved.
#
###############################################################################
from math import ceil, sqrt


def sieve(n):
    """Returns the list of primes using the Sieve of Eratosthenes"""
    A = [True] * (n-1)

    for i in xrange(2, int(ceil(sqrt(n)))+1):
        if A[i-2]:
            for k in xrange(0, n+1):
                j = i**2 + k*i
                if j > n:
                    break
                A[j-2] = False

    return [i+2 for i in xrange(0, len(A)) if A[i]]

print "List of primes: ", sieve(30)

{'fraction_non_alphanumeric': 0.2889800703399766, 'fraction_numerical': 0.03341148886283705, 'mean_word_length': 3.256857855361596, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1345564', 'n_tokens_mistral': 563, 'n_tokens_neox': 503, 'n_words': 152}