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 /Problem47.py |
Diffstat (limited to 'Problem47.py')
-rw-r--r-- | Problem47.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Problem47.py b/Problem47.py new file mode 100644 index 0000000..5da614d --- /dev/null +++ b/Problem47.py @@ -0,0 +1,20 @@ +def isPrime(n): + for x in range(2,int(n/2)+1): + if n%x == 0: return False + return True +def fourPrimeFactors(n): + multiples = [] + for x in range(2,int(n/2)+1): + if n%x == 0: multiples.append(x) + if(len(multiples)<4): return False + primecount,counter = 0,0 + while counter < len(multiples): + if primecount >=4: return True + if isPrime(multiples[counter]): primecount+=1 + counter+=1 + return False +for x in range(3,1000000): + if fourPrimeFactors(x) == True and fourPrimeFactors(x-1) == True and fourPrimeFactors(x-2) == True and fourPrimeFactors(x-3) == True: + print(x-3) + break + |