Beispiel #1
0
"""
Problem 10

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.

Find the sum of all the primes below two million.
"""
from algorithms import getprimes
print sum(getprimes(2000000))
Beispiel #2
0
# BROKEN
import sys
from algorithms import getprimes

factors = []
n = int(sys.argv[1])
for prime in getprimes(int(sys.argv[1])):
    if not n % prime:
        factors.append(prime)
        n = n / prime
print factors
Beispiel #3
0
from algorithms import getprimes

i = 0
for prime in getprimes():
    i += 1
    if i == 10001:
        print 'Prime is %s' % prime
        break