Change:
</div> </section> ## Solution <section id='solution'> ```js //noprotect function primeSummation(n) { <del> // Initialise an array containing only prime numbers let primes = [2]; let result = 2; function isPrime(y, primes) { // Find sqrt(y) const sqrt = Math.floor(Math.sqrt(y)); // Divide y by each applicable prime, return false if any of them divide y for (let i = 0; i < primes.length && primes[i] <= sqrt; i++) { if (y % primes[i] === 0) { return false; } } // At this point x must be prime return true; </del> <ins> if (n < 3) { return 0 }; let nums = [0, 0, 2]; for (let i = 3; i < n; i += 2){ nums.push(i); nums.push(0); </ins> } <del> // For every odd integer, add it to the array if it is prime for (let x = 3; x < n; x += 2) { if (isPrime(x, primes)) { if (x > n) { return result; } else { result += x; primes.push(x); </del> <ins> let sum = 2; for (let i = 3; i < n; i += 2){ if (nums[i] !== 0){ sum += nums[i]; for (let j = i*i; j < n; j += i){ nums[j] = 0; </ins> } } } <del> return result; </del> <ins> return sum; </ins> } ```

Discussion:
Describe your problem and how to reproduce it: The last test for this challenge needs additional time. I'm using optimized version of Sieve of Eratosthenes algorithm but the last case still times out: Here's the link to the code. The solution provided in the challenge's doesnt even pass the third test. I believe the tests are set to timeout after 100ms, if it could be increased to 200ms or 300ms, it should be doable. Add a Link to the page with the problem: Tell us about your browser and operating system: Browser Name: Chrome Browser Version: 70 Operating System: Windows 10 If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box):
It is caused by babel transform with loop-protect, which is set to 100 ms. Test timeout is set to 5 sec. Will you make a PR to replace a solution in the curriculum? It'll decrease the time of testing in Travis/CI. And in your solution at line 12 is not needed.
Thanks for replying. I'll make a PR updating the solution in curriculum and you're right line 12 is not required, I was trying to optimize the solution more by making the loop skip if that value is already but theres no point since accessing and assigning a value to an array is of anyway. I understand that it'll decrease the CI testing time. But updating the solution in curriculum would also update the test timeout for this challenge? Or something else would also need to be updated? Sorry, just trying to understand. Another quick question: Does the solution only needs to be updated in ? Or all languages? I'll make a PR for english folder but if it needs to be in all others too, let me know.
Update solution does not solve the problem with the test timeout. In addition, we have non-optimal solutions for problems 35 and 47.
Update solution does not solve the problem with the test timeout. Thats what I assumed too. How'd the timeout problem be solved? In addition, we have non-optimal solutions for problems 35 and 47. I'll update the PR with optimal solution of those.
need to increase this timeout:
I reckon changing that would increase for all challenges?

If so, is there a way to only increase for this challenge or others (presuming we find more challenges that require it)?
Problem 35 have 3 wrong assertion tests. I've created a new solution for Problem 35 (current one is wrong) and optimized 47 solution to be 4x times faster. However we'd still need to add additional time. Since the inputs are quite big in both challenges. Shall I update the PR to add correct test and solution for 35 and optimized solution for 47?
Let's do it in separate PRs