diff options
Diffstat (limited to '03-Largest-Prime-Factor/largestprime.py')
-rw-r--r-- | 03-Largest-Prime-Factor/largestprime.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/03-Largest-Prime-Factor/largestprime.py b/03-Largest-Prime-Factor/largestprime.py new file mode 100644 index 0000000..387de01 --- /dev/null +++ b/03-Largest-Prime-Factor/largestprime.py @@ -0,0 +1,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) |