Python solution,

import math def isPP(number : int) -> tuple: if(number > 3): for i in range(2, int(math.sqrt(number))+1): power = round(math.log(number)/math.log(i), 4) if power.is_integer(): return (i, int(power))

Output,

print(isPP(4)) # output -> (2, 2) print(isPP(9)) # output -> (3, 2) print(isPP(5)) # output -> None print(isPP(4)) # output -> (2, 2) print(isPP(8)) # output -> (2, 3) print(isPP(14)) # output -> None print(isPP(184528125)) # output -> (45, 5)

We're a place where coders share, stay up-to-date and grow their careers.

We strive for transparency and don't collect excess data.

## re: Daily Challenge #231 - Perfect Powers VIEW POST

FULL DISCUSSIONPython solution,

Output,