Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Well prime numbers are far beyond 21 and your code can be simplified even further.
PS: NOT a suggestion~~~~
Issues should not be written in ALL CAPS. Closing.
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 :)
Thanks gideo. Needed your wording to make sense of this.
This comment is hidden because it contains spoiler information about the solution
Hint: You're not meant to calculate the factorial. Find another way to find the number of zeros.
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
toreturn 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.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.