elendiastarman wrote:phix wrote:Hey ! I have implemented the Sieve of Eratosthenes logarithm but the actual creation of the list takes ages for me since I kind of bruteforced the non brute force way lol. I am currently learning to program by myself and with books I have bought (python by the way) and so far the first few problems wern't too much of a hassle but this one how can I create the list faster so I can implement this logarithm ?
Wish I could post my code but that would be against rules, I know I'm missing just a little tiny step, probably because of my lack of knowledge

Are you producing the primes and THEN sieving? If so, why don't you try building the prime list
alongside of the sieve? Like...every time your sieve finds a prime, it adds that prime to the list and keeps sieving.

LOOOOOOOOOOL I know what I was doing wrong omg... you guys are probably going to laugh your asses off.
I was trying to find the sum of the first 2 million primes, instead of the sum of the primes below the number 2000000 LOOOOL thats why my answer was always wrong...
I don't know if i have explained myself I was adding each prime 2,3,5,7, etc and each prime found counted as 1, so the sum of the first 4 primes is 17, while the problem was asking the sum of the primes below the number 4, aka > 2,3 so >>5.
*Slaps self across the face and picks up all the hair from the floor that fell due to stress trying to make this problem work XDDD*
Btw when I did the problem the wrong way (obviously it takes way longer) I did it both with C and Python and I was amazed at how much faster C was, I mean I knew it was faster, but not lightening years fast...