<commit_before><commit_msg>solving p7<commit_after>import unittest
import itertools
import math

class TestP7(unittest.TestCase):
	def test_6th_prime(self):
		self.assertEqual(13, calc_prime(6))

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

def prime_generator():
    return (num for num in itertools.count(2) if is_prime(num))

def calc_prime(num):
	return next(itertools.islice(prime_generator(), num-1, None))

if __name__ == '__main__':
	import time
	start = time.time()
	print calc_prime(10001)
	print "total secs: %f" % (time.time() - start)
	unittest.main()
{'fraction_non_alphanumeric': 0.13270142180094788, 'fraction_numerical': 0.02527646129541864, 'mean_word_length': 5.155339805825243, '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': '6654214', 'n_tokens_mistral': 244, 'n_tokens_neox': 237, 'n_words': 60}