My code will spit out clearly non prime numbers and im trying to figure out why
when I run the code, it outputs the prime numbers, but also occasionally output non primes too
x = 1
a = 4
b=2
#prints 2
print(2)
#prints 3
print(3)
#whilst x is under 1000, the next section of code will run
while x < 100:
#sets b to 2
b = 2
#will repeat aslong as b is less than a
while b < a:
#if a can be divided by b with no remainder
if a % b == 0:
#adds 1 to a
a = a+1
#if not will add one to b
else:
b = b+1
print(a)
a = a+1
x = x+1