Files
euler-project/problems/003_problem.py
2020-04-17 23:39:30 -04:00

30 lines
497 B
Python

# 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()