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