Sep-14-2018, 01:46 PM
Hello. Im trying to get the sum of all prime numbers under 2,000,000. In my code Ive tried to divide a number with only prime numbers in order to lower the amounts of iterations. The code, however, wont read my list of prime numbers as an integer and I get this error.
Error:Traceback (most recent call last):
File "python", line 7, in <module>
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
This is my codeprimes = [2, 3] sum = 5 test = 5 counter = 0 while counter < 10000: for i in range(1, int(test**0.5)+1, int(primes)): if i > 0: if test % i != 0: primes.append(i) sum += test counter += 2 test += 2 print(sum)How can I make my code read the list as an integer?