Exemple #1
0
def maxPrimes():
	a = -1
	b = 2 # b must be prime
	n = 0
	count = 0
	maxCount = 0
	maxA = 0
	maxB = 0
	while(abs(a) < 1000):
		while(abs(b) < 1000):
			while(sup.isPrime(function(n, a, b))):
				print function(n, a, b), a, b, n
				n += 1
				count += 1
			if(count > maxCount):
				maxCount = count
				maxA = a
				maxB = b
			n = 0
			count = 0
			b = findNextPrime(abs(b))
			#b *= -1	# used to check negative b values
		b = 2
		a -= 1
		#a += 1	# used to check positive a values

	print maxCount, maxA, maxB
Exemple #2
0
def bigPrime():
    i = 15
    count = 6
    while (count != 10001):
        if(sup.isPrime(i)):
            count += 1
        i += 2
    print i - 2
Exemple #3
0
def primeSum():
    i = 3   #lowest prime
    total = 2
    while(i < 2*10**6):
        if(sup.isPrime(i)):
            total += i
            i += 2
        else:
            i += 2
    print total
Exemple #4
0
def findNextPrime(n):
	num = n + 1
	while(not sup.isPrime(num)):
		num += 1

	return num