Largest prime factor
Problem 3
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
Answer
number = 600851475143
i = 2
m = 2
while number != 1:
if number % i == 0:
number = number / i
m = i
i = i + 1
print m
'Device & Language > Python' 카테고리의 다른 글
python eulerproject 6th : Sum square difference (0) | 2017.08.24 |
---|---|
python eulerproject 5th : Smallest multiple (0) | 2017.08.16 |
python eulerproject 4th : Largest palindrome product (0) | 2017.08.16 |
python eulerproject 2nd (0) | 2014.12.27 |
python eulerproject 1st (0) | 2014.12.23 |