Ad
  • Custom User Avatar

    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 !

  • Custom User Avatar

    Same. It's not even code optimisation, probably just a bit of math I'm missing.

  • Custom User Avatar

    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?

  • Custom User Avatar

    Oops, right. I wasn't sure my solution would always work, but I trusted the test cases (am in no way proficient in maths).

  • Custom User Avatar

    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.

  • Custom User Avatar

    Descrition unclear. No test cases. Value not what was expected when description doesn't mention what is expected. Delete this.

  • Custom User Avatar

    Ok, then why is the exception not caught if I run my program on my computer, or in my IDE, or in PythonTutor ?

  • Custom User Avatar

    Because a correct solution wouldn't raise an excetion?

  • Custom User Avatar

    Why the StopIteration raised using a generator is considered an error that prevents to submit an otherwise working solution ? (In Python)

  • Custom User Avatar

    You just need to edit your profile and write down the name of the clan you wish to join.