Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
sympy.perfect_power solution in 3rd party category for Checking Perfect Power by imloafer
import sympy
def perfect_power(n:int)-> bool:
return bool(sympy.perfect_power(n))
print("Example:")
print(perfect_power(9))
# These "asserts" are used for self-checking
assert perfect_power(8) == True
assert perfect_power(42) == False
assert perfect_power(441) == True
assert perfect_power(469097433) == True
assert perfect_power(4922235242952026704037113243122008064) == True
print("The mission is done! Click 'Check Solution' to earn rewards!")
Sept. 24, 2023
Comments: