def compute_wheel(limit): primes = seive(limit) circum = reduce(lambda x,y: x*y, primes, 1) spokes = [i for i in range(1, circum) if gcd(i, circum) == 1] diffs = [spokes[i+1] - s for i,s in enumerate(spokes[:-1])] diffs.insert(0, circum - spokes[-1] + 1) return primes, diffs
def treasure(): primes = praxis.seive(10**7) sums541 = sums(primes, 541, primes[-1]) sums41 = sums(primes, 41, primes[-1]) sums17 = sums(primes, 17, primes[-1]) sums7 = sums(primes, 7, primes[-1]) psums541 = intersect(primes, sums541) psums41 = intersect(psums541, sums41) psums17 = intersect(psums41, sums17) psums7 = intersect(psums17, sums7) return psums7[0]