This code begins at 5, and lists the following prime numbers up to your choice, which in this case, is the following 17 prime numbers. When I run it, 25 and 49 are printed. Why are they not filtered out?
start = 5
number = 1
divisor = 3
upper = start - 2
doc = open("hey.txt", "w")
while number <= 17:
if start % divisor == 0:
start = start + 2
divisor = 3
elif divisor == upper:
doc.write(str(start))
doc.write(", ")
number = number + 1
start = start + 2
divisor = 3
else:
divisor = divisor + 2
hey.txt: 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49, 53,