From b6c8ed6232606e8fff255efa7dba91493d19bc15 Mon Sep 17 00:00:00 2001 From: Jethro Stapelbroek Date: Fri, 13 May 2022 21:39:04 +0200 Subject: [PATCH] A List Game --- listgame.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 listgame.py diff --git a/listgame.py b/listgame.py new file mode 100644 index 0000000..9e4025c --- /dev/null +++ b/listgame.py @@ -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)))