Mercurial > hg > euler
changeset 11:0aeacd17f493
#3 solution
author | Dominic Cleal <dominic@computerkb.co.uk> |
---|---|
date | Mon, 01 Dec 2008 13:07:23 +0000 |
parents | 449e1d2e103c |
children | 76155198a9e2 |
files | problem3.py |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/problem3.py Mon Dec 01 13:07:23 2008 +0000 @@ -0,0 +1,17 @@ +import primes + +def find(f): + factors = [] + t = 1 + s = primes.sieve() + for p in s.sieve(): + if f % p == 0: + if not p in factors: + factors.append(p) + print "Factor found: %d" % (p) + t *= p + if t == f: + return factors + +print "Factors: %s" % (find(600851475143)) +