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.
This comment is hidden because it contains spoiler information about the solution
Task is very interesting. But testing is too worst... All my answers (4) get "Execution Timed Out". My local mashine compute them quikly (e.g. last of my answers get me about for each 20-300 ms for value like 371178756, 1 sec for value=10000000000L). There are a lot of tests that do not allow them to complete all by 16 seconds that codewars gives. I think it would be better if the test was shortened a bit.