I'm trying to just print out the found primes. I want to add to the prime[], but I get a TypeError
line 63, in isprime
primes += n
TypeError: 'int' object is not iterable
The code:
def isprime(n):
primes = []
if n == 1:
print '1 is special'
return False
for x in range(2, n):
if n%x == 0:
print '{} equals {} x {}'.format(n, x, n // x)
return False
else:
primes += n
print (n, "is a prime number")
return True
for n in range(1, 1000):
isprime(n)