From b77c8eec0963ab57a52d5372fed507e5b33b0bca Mon Sep 17 00:00:00 2001 From: Lauchmelder23 Date: Sun, 30 Sep 2018 21:32:59 +0200 Subject: [PATCH] Added Problem 3 --- Problem_3.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Problem_3.py diff --git a/Problem_3.py b/Problem_3.py new file mode 100644 index 0000000..69111d6 --- /dev/null +++ b/Problem_3.py @@ -0,0 +1,25 @@ +###################################################################### +# The prime factors of 13195 are 5, 7, 13 and 29. +# +# What is the largest prime factor of the number 600851475143 ? +# +###################################################################### + +primes = [1] +original = 600851475143 + +for x in range(1, int(original / 2)): + print(x) + tester = 600851475143 + for prime in primes: + tester /= prime + + if x > tester: + break + + if int(original) % x is 0: + primes.append(x) + original /= x + +print("{}".format(primes)) +# Solution: 6857