Example #1
0
from numbertheory import primeFactors
from collections import Counter
import operator

sum = 0
divisors = 1
x = 1

while divisors < 500:

    sum += x
    factors = Counter(primeFactors(sum)).values()
    factors = map(lambda i: i + 1, fact)
    divisors = reduce(operator.mul, fact, 1)

    x += 1

print sum
Example #2
0
# The prime factors of 13195 are 5, 7, 13 and 29.
# What is the largest prime factor of the number 600851475143 ?

#Trial division

import numbertheory


N = 600851475143
f = numbertheory.primeFactors(N)
print f