Created
October 19, 2020 20:07
-
-
Save mcvarer/a6cab1570252e10dcc09522f5ba99879 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
The prime factors of 13195 are 5, 7, 13 and 29. | |
What is the largest prime factor of the number 600851475143 ? | |
""" | |
def largestPrimeFactor(flt: int, n: int) -> int: | |
while flt ^ 2 < n: | |
while n % flt == 0: | |
n = n // flt | |
flt += 1 | |
return n | |
print("largest prime factor of the number = {}".format(largestPrimeFactor(flt=2, n=600851475143))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment