From 4021de722787c4594ce1a0de9359654767e167df Mon Sep 17 00:00:00 2001 From: Shaun Setlock Date: Sun, 19 Apr 2020 00:27:49 -0400 Subject: [PATCH] Automatic commit performed through alias... --- problems/003_problem.py | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/problems/003_problem.py b/problems/003_problem.py index 3342a19..a443872 100644 --- a/problems/003_problem.py +++ b/problems/003_problem.py @@ -7,21 +7,10 @@ # What is the largest prime # factor of the number 600851475143 ? # + import decorators import time -#def treat_evens(n): -# mod_is_zero = True -# done = True -# dividend = 2 -# while mod_is_zero or done: -# done = dividend == n -# num = n/dividend -# mod_is_zero = 0 == n%dividend -# dividend *= 2 -# print("{}".format(num)) -# return num - # Create function that finds the next # prime number when supplied with an # intitial integer. @@ -46,12 +35,20 @@ def return_next_prime(start_n,max_n): @decorators.function_timer def main(): - orig = 600851475143 - start = 3 - returned_prime = start - while returned_prime < orig: - returned_prime = return_next_prime(start,orig).__next__() - print("A PRIME HAS BEEN FOUND!!!! ... {}".format(returned_prime)) - start = returned_prime + result1 = orig = 600851475143 + returned_prime = prime_start = 2 + factor_list = [] + + while returned_prime < orig ** 0.5 and returned_prime