From 5ee02e30bc3342b4f0b6043f0181baec437fc0fd Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Mon, 12 Apr 2010 15:53:00 +0000 Subject: [PATCH] Problem 003 git-svn-id: file:///srv/svn/euler@20 e5f4c3ec-3c0c-11df-b522-21efaa4426b5 --- 003.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 003.py diff --git a/003.py b/003.py new file mode 100644 index 0000000..ee18939 --- /dev/null +++ b/003.py @@ -0,0 +1,12 @@ +def factor(n): + i = 2 + while (n % i != 0 and i < n): + i = i + 1 + if i == n: + return [n] + p = factor(n // i) + p.append(i) + return sorted(p, reverse=True) + +print 'Prime factors of 600851475143:' +print factor(600851475143)