summaryrefslogtreecommitdiff
path: root/047.py
diff options
context:
space:
mode:
Diffstat (limited to '047.py')
-rw-r--r--047.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/047.py b/047.py
new file mode 100644
index 0000000..19f5185
--- /dev/null
+++ b/047.py
@@ -0,0 +1,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
+