A List Game

This commit is contained in:
2022-05-13 21:39:04 +02:00
parent 118a4e0ecc
commit b6c8ed6232

19
listgame.py Normal file
View File

@@ -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)))