summaryrefslogtreecommitdiff
path: root/Problem47.py
diff options
context:
space:
mode:
Diffstat (limited to 'Problem47.py')
-rw-r--r--Problem47.py20
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
+