From 907449046d50b522daaffab8b7ab7def2adb819c Mon Sep 17 00:00:00 2001 From: Shaun Setlock Date: Fri, 17 Apr 2020 23:39:30 -0400 Subject: [PATCH] Automatic commit performed through alias... --- problems/003_problem.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 problems/003_problem.py diff --git a/problems/003_problem.py b/problems/003_problem.py new file mode 100644 index 0000000..eed64b0 --- /dev/null +++ b/problems/003_problem.py @@ -0,0 +1,30 @@ + +# Problem 3: +# +# The prime factors of 13195 +# are 5, 7, 13 and 29. +# +# What is the largest prime +# factor of the number 600851475143 ? +# +import decorators + +def treat_evens(n): + mod_is_zero = True + dividend = 2 + while mod_is_zero: + num = n/dividend + mod_is_zero = 0 == n%dividend + dividend *= 2 + print("{}".format(num)) + return num + +@decorators.function_timer +def main(): + + orig = 600851475143 + num = treat_evens(orig) + + print("Highest prime of 600851475143 is {}".format(num)) + +main() \ No newline at end of file