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 ?
- '''
- from math import sqrt
- def findDivisorsOf(n):
- divisors = list()
- for i in range(2, int(sqrt(n) + 1)):
- if n % i == 0:
- divisors.append(i)
- return divisors
- 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
- divisors = findDivisorsOf(n)
- print(divisors)
- for i in range(len(divisors)):
- print(divisors[i], findDivisorsOf(divisors[i]))
- print(int(486847/71))
- print(isPrime(6857))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement