def prime():
i = 2 #the first index
numToTest = 5 #the first candidate prime
listOfPrimes = [] #list of primes
for i in range (2, 1001):
if (numToTest-1)%6 == 0:
listOfPrimes.append(numToTest) #it's prime. put in list
numToTest += 2 #go to next odd number
i += 1 #go to next index
elif (numToTest+1)%6 == 0:
listOfPrimes.append(numToTest) #it's prime. put in list
i += 1 #go to next index
numToTest += 2 #go to next odd number
else:
numToTest += 2 #go to next odd number
print listOfPrimes[-1]