Project Euler/10

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Project Euler Problem 10 is a problem related to prime numbers. The task is to find the sum of all prime numbers below 2000000.

Implementations

Python

primes=[]
sieve=[0]*2000005
for i in range(2,2000000):
    if not sieve[i]:
        primes.append(i)
    for j in primes:
        if j*i>=2000000:
            break
        sieve[j*i]=1
        if not i%j:
            break
print(sum(primes))

Unfortunately, this does not work on the answer checking in Project Euler Mirror, but this is technically correct, isn't it?