Esempio n. 1
0
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)))
Esempio n. 2
0
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)))
Esempio n. 3
0
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
Esempio n. 4
0
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()
Esempio n. 5
0
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()
Esempio n. 6
0
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
Esempio n. 7
0
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))]
Esempio n. 8
0
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))]
Esempio n. 9
0
def main():
	print(sum(primes.primesTo(2000000)))