Exemplo n.º 1
0
def get_prime_sum(limit):
    # Start with the first prime.
    prime_sum = 2
    for x in xrange(3, limit + 1, 2):
        if is_prime_eff(x):
            prime_sum += x

    return prime_sum
Exemplo n.º 2
0
def get_nth_prime(n):
    # Cutting corners, problem gives 6 primes, starting at there.
    prime_count = 6
    current_prime = 13

    for x in count(current_prime + 2):
        if eu.is_prime_eff(x):
            current_prime = x
            prime_count += 1

            if prime_count == n:
                break

    return current_prime