mirror of
https://github.com/correl/euler.git
synced 2024-11-27 19:19:50 +00:00
Renamed prime factor function
git-svn-id: file:///srv/svn/euler@34 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
parent
0506c81f6e
commit
9d98a914f5
1 changed files with 3 additions and 3 deletions
6
e003.py
6
e003.py
|
@ -1,12 +1,12 @@
|
||||||
def factor(n):
|
def pfactor(n):
|
||||||
i = 2
|
i = 2
|
||||||
while (n % i != 0 and i < n):
|
while (n % i != 0 and i < n):
|
||||||
i = i + 1
|
i = i + 1
|
||||||
if i == n:
|
if i == n:
|
||||||
return [n]
|
return [n]
|
||||||
p = factor(n // i)
|
p = pfactor(n // i)
|
||||||
p.append(i)
|
p.append(i)
|
||||||
return sorted(p, reverse=True)
|
return sorted(p, reverse=True)
|
||||||
|
|
||||||
print 'Prime factors of 600851475143:'
|
print 'Prime factors of 600851475143:'
|
||||||
print factor(600851475143)
|
print pfactor(600851475143)
|
||||||
|
|
Loading…
Reference in a new issue