Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (20 sloc) 466 Bytes
import math
def isPrime(number):
greatestPotFactor = math.sqrt(number)
x = 2
while x <= greatestPotFactor:
if number % x == 0:
return False
else:
x += 1
return True
def greatestPrimeFactor(number):
greatestPotFactor = math.sqrt(number)
x = 2
greatestPrimeFactor = 0
while x < greatestPotFactor:
if isPrime(x) == True and number % x == 0:
greatestPrimeFactor = x
x += 1
return greatestPrimeFactor
print greatestPrimeFactor(600851475143)
Something went wrong with that request. Please try again.