summaryrefslogtreecommitdiff
path: root/047.py
blob: 19f5185ee40bff86c92f0a5781a57ea46dd04609 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from common import sieve

primes = list(sieve(1000000).primes())
primes.sort()

factors = 4

def check_prime_factors(x):
	distinct = set()
	for p in primes:
		while x % p == 0:
			x /= p
			distinct.add(p)
		if x == 1:
			break
	return len(distinct) == factors

n = 644

while True:
	if check_prime_factors(n) and check_prime_factors(n+1) and check_prime_factors(n+2) and check_prime_factors(n+3):
		print n
		break
	n += 1