A List Game
This commit is contained in:
1 parent
118a4e0ecc
commit
b6c8ed6232
1 file changed
+19
+19
@@ -0,0 +1,19 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
x = int(sys.stdin.readline())
|
||||||
|
|
||||||
|
def prime_factors(n):
|
||||||
|
"""Returns all the prime factors of a positive integer"""
|
||||||
|
factors = []
|
||||||
|
d = 2
|
||||||
|
while n > 1:
|
||||||
|
while n % d == 0:
|
||||||
|
factors.append(d)
|
||||||
|
n /= d
|
||||||
|
d = d + 1
|
||||||
|
if d*d > n:
|
||||||
|
if n > 1: factors.append(n)
|
||||||
|
break
|
||||||
|
return factors
|
||||||
|
|
||||||
|
print(len(prime_factors(x)))
|
||||||
Reference in new issue
Block a user