Ad
  • Custom User Avatar

    Python tests go up to 65535, in which doing exponentation on every possible number yields 4294836225 iterations. Imagine doing such costly computation for 100 tests or so...

    Optimization is required. You can find a mathematical threshold to stop looping, or find common properties of numbers possessing perfect powers ! ^^

  • Custom User Avatar

    That means you need to optimize your algorithm