From 95341b61b030c9e1290f3b326cb7ec584f543aea Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sun, 31 Aug 2014 20:21:45 +0200 Subject: moved files to higher directory after split to new repository --- 047.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 047.py (limited to '047.py') 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 + -- cgit v1.2.3