def problem_7(): """What is the 10 001st prime number?""" # Upper bound on nth prime: # http://www.ams.org/journals/mcom/1999-68-225/S0025-5718-99-01037-6/S0025-5718-99-01037-6.pdf n = 10001 num_primes = 0 for lim in xrange(0, n * int(log(n) + log(log(n))), 1000): p = helper.get_primes(lim + 1000, lower=lim) if num_primes + len(p) >= 10001: return p[n - num_primes - 1] num_primes += len(p)
def problem_10(): """Find the sum of all the primes below two million""" return sum(helper.get_primes(2000000))