Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Find the largest prime factor of 600851475143
- #Here's an attempt at bruteforcing the problem, wish me luck.
- #initializing some variables for use
- Number = 600851475143
- numCheck = (Number / 2) + 1
- factorCheck = 0
- highestFound = 0
- def checkPrimeness(num):
- uBound = int((num ** 0.5) + 1)
- lBound = 1
- check = lBound
- while check < uBound:
- check = check + 1
- if num % check == 0:
- return 0
- return 1
- while numCheck > 0:
- print numCheck
- numCheck = numCheck - 1
- if Number % numCheck == 0:
- if checkPrimeness(numCheck) == 1:
- print numCheck
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement