Pre store K power K form of numbers Loop till 8 , because 8 ^ 8 > 10 ^ 7
for i in range ( 1 , 9 ) : NEW_LINE INDENT val = 1 NEW_LINE for j in range ( 1 , i + 1 ) : NEW_LINE INDENT val *= i NEW_LINE DEDENT kPowKform [ val ] = 1 NEW_LINE DEDENT canBeConverted ( N ) NEW_LINE