euler/e003.py
Correl Roush 9d98a914f5 Renamed prime factor function
git-svn-id: file:///srv/svn/euler@34 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
2010-04-12 15:53:13 +00:00

12 lines
255 B
Python

def pfactor(n):
i = 2
while (n % i != 0 and i < n):
i = i + 1
if i == n:
return [n]
p = pfactor(n // i)
p.append(i)
return sorted(p, reverse=True)
print 'Prime factors of 600851475143:'
print pfactor(600851475143)