Ad
  • Custom User Avatar

    in Haskell using a sieve of Erathostenes does not offer running time of below 12,000ms. I assume this is because the sieve is recomputed at each call to gap function.
    Can you acknowledge that in your case you are using some static storage for the sieve ?

  • Default User Avatar

    I would like to mention that you can use a list to store the primes. I used an O(n) sieve of eratosthenes and my solution passed.

  • Custom User Avatar

    Anyone can order millions of tests

    Except there're only 100 tests in JavaScript (which I suppose you're using), so no, your solution is simply bad.

  • Custom User Avatar

    Avoid the idea of using a list for storing the numbers.
    This helped me beat the timeout error.

  • Custom User Avatar

    Not an issue. Implementing a solution efficient enough to pass the tests in time is a part of the task, whether you like it or not.