aboutsummaryrefslogtreecommitdiffstats
path: root/largestprime.py
blob: 387de015d704999ddef517d9cad7fbff5db5cd69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import PIL
import math
# Problem 3 Largest Prime Factor
def lpf(number):
    factor = 2
    while (number > factor):
        if(number % factor == 0):
            number = number/factor
            factor = 2
        else:
            factor += 1
    return factor


out = lpf(600851475143)
print(out)