def main(): squares = [i**2 for i in primes.primesTo(1 + int(LIMIT**(1 / 2)))] cubes = [i**3 for i in primes.primesTo(1 + int(LIMIT**(1 / 3)))] fourths = [i**4 for i in primes.primesTo(1 + int(LIMIT**(1 / 4)))] numbers = [] for s in squares: for c in cubes: for f in fourths: if s + c + f < LIMIT: numbers.append(s + c + f) print(len(set(numbers)))
def main(): squares = [i ** 2 for i in primes.primesTo(1 + int(LIMIT ** (1/2)))] cubes = [i ** 3 for i in primes.primesTo(1 + int(LIMIT ** (1/3)))] fourths = [i ** 4 for i in primes.primesTo(1 + int(LIMIT ** (1/4)))] numbers = [] for s in squares: for c in cubes: for f in fourths: if s + c + f < LIMIT: numbers.append(s + c + f) print(len(set(numbers)))
def main(): primenums = primes.primesTo(10 ** 4) #primes.readPrimes() i = 11 while True: #if not (i-1) % 100: print(i) if i not in primenums: if not any((i - (2*(j**2))) in primenums for j in range(1, int((i / 2) ** 0.5) + 1)): print(i) break i += 2
def main(): #print(followsProperty(1487, 4817, 8147)) for p in primes.primesTo(10**4): if p < 1000: continue if p == 1487: continue for i in range(1, 4000): if followsProperty(p, p + i, p + i + i): print(str(p) + str(p + i) + str(p + i + i)) exit()
def main(): #print(followsProperty(1487, 4817, 8147)) for p in primes.primesTo(10 ** 4): if p < 1000: continue if p == 1487: continue for i in range(1, 4000): if followsProperty(p, p + i, p + i + i): print(str(p) + str(p+i) + str(p+i+i)) exit()
def main(): primenums = primes.primesTo(10**4) #primes.readPrimes() i = 11 while True: #if not (i-1) % 100: print(i) if i not in primenums: if not any((i - (2 * (j**2))) in primenums for j in range(1, int((i / 2)**0.5) + 1)): print(i) break i += 2
def longestConsecutiveUnder(limit): primeslist = primes.primesTo(limit) #print(primeslist) consecs = [] sums = [] for startindex in range(len(primeslist)): for endindex in range(startindex + 1, len(primeslist)): s = sum(primeslist[startindex : endindex]) if s > limit: break if primes.isPrime(s): consecs.append(endindex - startindex) sums.append(s) #print(consecs) #print(sums) return sums[consecs.index(max(consecs))]
def longestConsecutiveUnder(limit): primeslist = primes.primesTo(limit) #print(primeslist) consecs = [] sums = [] for startindex in range(len(primeslist)): for endindex in range(startindex + 1, len(primeslist)): s = sum(primeslist[startindex:endindex]) if s > limit: break if primes.isPrime(s): consecs.append(endindex - startindex) sums.append(s) #print(consecs) #print(sums) return sums[consecs.index(max(consecs))]
def main(): print(sum(primes.primesTo(2000000)))