diff options
author | Joshua Drake <joshua.drake@ditchwitch.com> | 2023-04-07 08:13:49 -0500 |
---|---|---|
committer | Joshua Drake <joshua.drake@ditchwitch.com> | 2023-04-07 08:13:49 -0500 |
commit | 1161f9a034de06a63538e3a9a0b7717098c744d9 (patch) | |
tree | 55bb842b2daa4f096eb7916a8d3630426fc1c376 /Problem3.py |
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 |