# Suggestion for Project Euler

**URL:** <https://forum.freecodecamp.org/t/suggestion-for-project-euler/731013>\
**Category:** freeCodeCamp Contributors\
**Tags:** contributing\
**Created:** [January 20, 2025, 8:02pm UTC](https://forum.freecodecamp.org/t/suggestion-for-project-euler/731013 "2025-01-20T20:02:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![c0d1ng\_ma5ter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/c0d1ng_ma5ter/32/362487_2.png) [@c0d1ng\_ma5ter](https://forum.freecodecamp.org/u/c0d1ng_ma5ter)\
**Post date:** [January 20, 2025, 8:02pm UTC](https://forum.freecodecamp.org/t/suggestion-for-project-euler/731013/1 "2025-01-20T20:02:43Z")

</div>

Hello. Recently I was solving Project Euler problem 10 (namely, summation of primes)

My code works fine, but it just doesn’t pass test 5 ( `primeSummation(2000000)` should return 142913828922.)

```js
function primeSummation(n) {
  let primes = [2]
  let nums = []
  let i = 2

  for (i = 2; i < n; i++) {
    nums.push(i)
  }

  let shallowcopy = nums

  for (i = 2; i < n; i++) {
    shallowcopy.shift()
    shallowcopy = shallowcopy.filter((num) => num % i != 0)
    if (shallowcopy[0]) {
      primes.push(shallowcopy[0])
    }
  }

  let sum = primes.reduce((a,b) => a + b)
  console.log(`The prime summation of ${n} is ${sum}`)
  return sum
}

primeSummation(2000000)

```

This is solely because of the infinite loop detection thing.

Acording to the PE page:

> Each problem has been designed according to a “one-minute rule”, which means that although it may take several hours to design a successful algorithm with more difficult problems, an efficient implementation will allow a solution to be obtained on a modestly powered computer in less than one minute.

Meanwhile, the infinite loop detection on the code editor fires after around 10 seconds in a loop or less

My suggestion is to increase this limit ONLY on PE to at least 40 seconds

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 20, 2025, 8:36pm UTC](https://forum.freecodecamp.org/t/suggestion-for-project-euler/731013/2 "2025-01-20T20:36:18Z")

</div>

Feel free to [open an issue](https://github.com/freeCodeCamp/freeCodeCamp/issues/new/choose) on this

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [January 20, 2025, 8:43pm UTC](https://forum.freecodecamp.org/t/suggestion-for-project-euler/731013/3 "2025-01-20T20:43:19Z")

</div>

This is a slow solution though

---

<div class="post-metadata">

**Author:** ![c0d1ng\_ma5ter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/c0d1ng_ma5ter/32/362487_2.png) [@c0d1ng\_ma5ter](https://forum.freecodecamp.org/u/c0d1ng_ma5ter)\
**Post date:** [January 21, 2025, 2:25pm UTC](https://forum.freecodecamp.org/t/suggestion-for-project-euler/731013/4 "2025-01-21T14:25:40Z")

</div>

Done!

> <https://github.com/freeCodeCamp/freeCodeCamp/issues/58262>
>
> \### Is your feature request related to a problem? Please describe.
> 
> Hello! Recen…tly, I was solving Project Euler problem 10 (Summation of Primes). Sadly, however, while my code worked just fine, it just wouldn't pass the last test
> 
> This was simply because my implementation was not efficient enough to not trigger the infinite loop / timeout detection
> 
> !\[Image\](https://github.com/user-attachments/assets/e22d914e-cc39-4b7e-af53-689be243cdb8)
> 
> I've had this exact same issue with problems 4 (Largest Palindrome Product) and 7 (10001st prime), as well as Rosetta Code's Extensible Prime Generator and Bogosort.
> 
> \### Describe the solution you'd like
> 
> Initially I was just annoyed and thought my implementation had to be more efficient, but then went to the Project Euler website and read the following:
> 
> \> Each problem has been designed according to a “one-minute rule”, which means that although it may take several hours to design a successful algorithm with more difficult problems, an efficient implementation will allow a solution to be obtained on a modestly powered computer in less than one minute.
> 
> In the meantime, FCC will break out of a loop after 10-ish seconds inside of it, even if it's not infinite.
> 
> My suggestion is to delay this to about 30 to 50 seconds inside of the Project Euler challenges (and perhaps Rosetta Code as well)
> 
> This is because, while the loop detection is incredibly handy in the regular curriculum, it's just a nuisance in the context of PE and Rosetta, which are much more complex challenges that take relatively longer to run
> 
> \### Describe alternatives you've considered
> 
> If this was not possible for some reason, you could at least make the final test a little less demanding so it doesn't take that long to run.
> 
> While this wouldn't get us to the true answer of the problem, it would at least allow the user to pass the tests without constant frustration.
> 
> \### Additional context
> 
> Forum post relating to this (and code): https://forum.freecodecamp.org/t/suggestion-for-project-euler/731013

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [July 23, 2025, 2:26am UTC](https://forum.freecodecamp.org/t/suggestion-for-project-euler/731013/5 "2025-07-23T02:26:21Z")

</div>

Closed on July 23, 2025, 2:26am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
