Ad
  • Default User Avatar

    Anything related to trial division is just lame. :P

  • Default User Avatar

    not really, -41 is not a prime number, but 41 is. Why? because 41 has to be divisible by itself or by 1. Which means that something has to exist to divide 41. To divide -41 you will have to divide it with quantities that do not exist. -1 for example is a sense can represent 'lack' of something rather than '1' which means something atleast exists 1 time.

  • Default User Avatar

    really intersting

  • Default User Avatar

    Loved it! Made me crack my brains for a good while as a beginner. Thanks :)

  • Default User Avatar

    This is a very interesting kata. There are trivial answers, and then there are very difficult (and more efficient) answers which could utilize advanced number theory and/or combinatorics. It's amazing just how difficult counting problems can actually be.

  • Custom User Avatar

    Code efficiency is a problem you have to solve.

  • Custom User Avatar

    this kata challenges more my code efficiency than the actual problem solving skill.

  • Custom User Avatar

    Hello guys, to whom may have encoutered the execution time error. (Your codes take too much time to execute even though you solved the problem)

    This made me come to realize that this platform codewars isn't about statistics or proving how master you are in coding. it's about learning and improving your programming skill.
    Therefore, It all comes down to "algorithm", the first 15 minute of this video https://www.youtube.com/watch?v=8hly31xKli0 will blow your mind.

  • Default User Avatar

    Thanks, found my mistake. i need to make it better because its too slow

  • Default User Avatar
    1. your code is not efficient enough
    2. very carefully (re)read the entire description
  • Default User Avatar

    it keeps saying timed out. -_- i am new can someone help me

  • Default User Avatar

    sorry, i am quite new and now that i saw the solutions i get it.
    I would still leave the comment up, if others run in the same issue.

    thanks

  • Custom User Avatar

    Read the description:

    NOTE on performance: There are no fancy optimizations required, but still the most trivial solutions might time out. Numbers go up to 2^31 ( or similar, depending on language ). Looping all the way up to n, or n/2, will be too slow.

    And that's what your code does, so, no wonder it will fail.

  • Default User Avatar

    The kata works fine in Java (your language). Your code timing out is not a kata issue. You need to write a more efficient algorithm.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...