diff options
Diffstat (limited to 'Problem3.py')
-rw-r--r-- | Problem3.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Problem3.py b/Problem3.py new file mode 100644 index 0000000..acfe7b3 --- /dev/null +++ b/Problem3.py @@ -0,0 +1,24 @@ +def isPrime(x): + factorlist = [] + for n in range(1 , x+1): + if x % n == 0: + factorlist.append(n) + #print(len(factorlist)) + if len(factorlist) == 2: + return True + else: + return False + + +def primeFactors(x): + factorlist = [] + for n in range(1 , int(x/2)): + if x % n == 0: + if isPrime(n): + factorlist.append(n) + print(n) + print("Done!") + #print(len(factorlist)) + +primeFactors(600851475143) +#print(isPrime(5))
\ No newline at end of file |