Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- The prime factors of 13195 are 5, 7, 13 and 29.
- What is the largest prime factor of the number 600851475143 ?
- '''
- def isPrime(n):
- flag = True
- for i in range(2, int(n/2)):
- if n % i == 0:
- flag = False
- break
- return flag
- # MAIN FUNCTION
- N = 600851475143
- factors = []
- for i in range(2, int(N/2)):
- if N % i == 0 and isPrime(i):
- factors.append(i)
- print(factors[len(factors)-1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement