Ad
  • Default User Avatar

    Well prime numbers are far beyond 21 and your code can be simplified even further.

    PS: NOT a suggestion~~~~

  • Custom User Avatar

    Issues should not be written in ALL CAPS. Closing.

  • Custom User Avatar

    Your solution seems a bit weak to pass this performance intensive kata, so I would suggest either a massive refactoring or to grow some more muscles with other katas.

    Cheers :)

  • Custom User Avatar

    Thanks gideo. Needed your wording to make sense of this.

  • Custom User Avatar

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

  • Custom User Avatar

    Hint: You're not meant to calculate the factorial. Find another way to find the number of zeros.

  • Custom User Avatar

    Please can you post Kata-specific problems on the discourse page for that Kata instead of the forum which is for general topics. Each Kata has an automatic discourse page in which you can mark your comment as a question, which means it's easier for me to help (since it's easier to find). Also, since this is a forum page, I can't mark your comment as a spoiler, meaning people can look at your code and use it themselves, however on the discourse page I can hide your solution.

    Regarding your problem, change return 1 to return n because you want it to start counting at 1 and not 2 (1 + 1 = 2, whilst 0 + 1 = 1), which causes the program to become 1 step (loop) above what it should be.

  • Custom User Avatar

    If the problem is Kata specific, you should post on the discourse page for that Kata instead of the forum which is for general topics.

    Refresh the page, sometimes Codewars is buggy is leaves code from previous attempts, if you refresh then it will remove this and you should be able to pass. I just tried your code and it seems to work fine.