Sum All Primes; what helped me

TL;DR :

1 https://youtu.be/Jx8TjIMJwTQ
2 https://benmccormick.org/2017/11/28/sieveoferatosthenes/


I really have a lot of difficulty with the math-based challenges even though I feel pretty comfortable with coding in general. Sum All Primes is one of those that took me hours of reading / watching videos, sleep on it, repeat… before I was able to create a solution.

I realized pretty quick that implementing the siv of ears toes the knees was the solution, but that didn’t help. I understand the concept of the algorithm pretty soon, but I couldn’t get my head around turning that into code. Nothing I read or watched really sunk in. I definitely could have copy/pasted a solution, but I’m not okay with that.

I finally stumbled across a video that made it very plain and easy for me to understand. Judging by the watermark, it looks like it may have been prepared for a Udemy course, but I get the impression that generating prime numbers is a recurring requirement in a lot of coding challenges: https://youtu.be/Jx8TjIMJwTQ

There’s another page that actually might have a better implementation using a JavaScript Generator, but I didn’t understand it until after I watched the video: https://benmccormick.org/2017/11/28/sieveoferatosthenes/

Before someone cries foul… No, I don’t know the author of the blog post or the creator of the video. It’s just a helluva coincidence that the video was posted after I started working on the problem.