From 1161f9a034de06a63538e3a9a0b7717098c744d9 Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Fri, 7 Apr 2023 08:13:49 -0500 Subject: Initial Commit --- Problem47.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Problem47.py (limited to 'Problem47.py') 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 + -- cgit v1.2.3