summaryrefslogtreecommitdiff
path: root/Problem47.py
blob: 5da614dc48f5f299c518348a7ed684b5a2dafdc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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