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.
Your code will fail with nested loops. You need to find a more efficient way to compute the answer. Nobody should give you any formula, that would be giving the solution.
This kata can be solved without applying special formulas from Numberphile video. It is just for educational purposes. Try to come up with something "easier"
Even numbers do not need special handling.
(message deleted cause I'm not sure it's right...)
hahah and i think why pop and shift doesnt work :D
Your answer is running in O(n^2) time! The outer for loop is the first "n", but your call to Array.indexOf() does another linear search through the array for a second "n" search, increasing the time by quite a lot!
I recommend searching online for some of the Kata tags for clues :)