myMy code takes 2 milliseconds to execute from tip to tail ...
600851475143
import math
import time
number = int(input("> "))
start_time = time.time()
def prime_factors(number):
# 600851475143
import math
import time
number = int(input("> "))
start_time = time.time()
def prime_factors(number):
prime_factorization = []
box = number
while number > 1:
for i in range(math.floor(math.log2(number))):
for j in range(2, number + 1):
if number % j == 0:
prime_factorization.append(j)
number = number//j
last_factor = j
if last_factor > math.sqrt(box):
return prime_factorization
break
return prime_factorization
print(f"Prime factors = {prime_factors(number)}")
print(f"execution time = {time.time() - start_time} seconds")
print(f"Prime factors = {prime_factors(number)}")
print(f"execution time = {time.time() - start_time} seconds")