Ad
  • Custom User Avatar

    bad exercise.

  • Custom User Avatar

    no libraries are blocked in this kata, there is only the code character count limit

  • Custom User Avatar

    Right? That's why I said i thought it was blocked by this kata without that rule being specified in the instructions.

  • Custom User Avatar

    That's weird, in some other kata seems to work. At least, it doesn't throw an error when importing it. Maybe it's related to the characters limit?

  • Custom User Avatar

    SciPY is on the list of available libraries in the above link, but I cannot access it for the purposes of this kata.

  • Custom User Avatar

    @abrunk read which libraries you can use here: https://docs.codewars.com/languages/python

  • Custom User Avatar

    The kata does not block Scipy, it's simply not installed on Codewars.

  • Custom User Avatar

    The kata doesn't even specify which libraries are blocked. All the formula-based ones I can find require scipy which appears to be blocked. Am I to understand that the only way to solve this is to construct the prime counting theorem from scratch? That's not really a coding exercise to to speak.

  • Custom User Avatar

    that's what I said o_O

  • Custom User Avatar

    As I understand it, "come up with" means research. Unless you are a mathematician by trade :P

  • Custom User Avatar

    those libraries are not required, you need to come up with research a specific "prime counting" algorithm

  • Custom User Avatar

    I guess you are supposed to implement a quick algorithm to count primes.
    You have numpy and gmpy2 to help you dealing with a fast implementation.

  • Custom User Avatar

    This seems impossible i used 6n+1, 6n-1 theorem which means that i'm reducing the loops by 66.67%.In my IDE it runs in 7.11 secs for 10000000.However here, it shows tle.

  • Custom User Avatar

    Tried several ways to do this but keep timing out at the higher levels. Anyone who completed willing to give a hint?

    Is the correct solution to use a sieve to generate the primes or to use a formula to determine the number? When I try the former it keeps timing out, when I try the latter none of the libraries that have the needed functionality seem to be available.

  • Custom User Avatar

    Thanks, I figured this out.

  • Loading more items...