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.
Ah, I left one extra line in, damn.
Well, I didn't know about the ModPow function, and as my Maths knowledge is severely lacking, I didn't realize I could have just looked up the 9 possible cycles instead of calculate them, but well, I'm glad I made it eventually !
Same. It's not even code optimisation, probably just a bit of math I'm missing.
Ok, I would have thought that You are proficient, because of the prime-number stuff... Unfortunately I do not know about a way to generate primes, i.e. every algorithm like yours has the limitation of just finding the right answer for the primes you included - and for all of their possible products of course. Probably execution-times are very low, since you are only checking for the primes.
My own algorithm is much worse - though it passed the auto-grader... But - in the end we are here for learning, aren't we?
Oops, right. I wasn't sure my solution would always work, but I trusted the test cases (am in no way proficient in maths).
n=2048 : should [2, 11] ---> get: None
Nice idea to use prime powers only, but keeps the algorithm from working when k consists of primes not in your list.
Descrition unclear. No test cases. Value not what was expected when description doesn't mention what is expected. Delete this.
Ok, then why is the exception not caught if I run my program on my computer, or in my IDE, or in PythonTutor ?
Because a correct solution wouldn't raise an excetion?
Why the StopIteration raised using a generator is considered an error that prevents to submit an otherwise working solution ? (In Python)
You just need to edit your profile and write down the name of the clan you wish to join.