project-euler-100

[RADIOACTIVE] solutions to the first 100 challenges of project euler
git clone git://git.figbert.com/project-euler-100.git
Log | Files | Refs | README

commit f96694d332c1ee6522c186a9973ecfc6ede38cc0
parent 823f3d13993ab2cb47ed58f00dfa486a3d194555
Author: therealFIGBERT <figbertwelner@gmail.com>
Date:   Tue, 21 Jan 2020 16:27:30 -0800

Simplify solution to problem 3

Diffstat:
Mproblem003.py | 9+--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/problem003.py b/problem003.py @@ -23,12 +23,5 @@ def primeFactors(num): return primes -def largestInList(lst): - largest = 0 - for i in range(len(lst)): - largest = lst[i] if lst[i] > largest else largest - return largest - -factors = primeFactors(600851475143) -answer = largestInList(factors) +answer = max(primeFactors(600851475143)) print("The largest prime factor of the number 600851475143 is %s" % answer) \ No newline at end of file