Problem 46

completed December 17, 2011

Code

primeslist = [2]
def iscomposite(n):
	for i in range(2, int(n**.5)+1):
		if n%i == 0: return 'true'
	primeslist.append(n)
	return 'false'

def conjecture(n):
	for i in range(int((n/2)**.5)+1):
		for p in primeslist:
			if n == p + 2*(i**2): return 'true'
	return 'false'

c = 'true'
n = 3
while c != 'false':
	n += 2; print n
	if iscomposite(n) == 'true':
		c = conjecture(n)

print n, 'makes the conjecture false'