Pre store K power K form of numbers Loop till 8 , because 8 ^ 8 > 10 ^ 7
for ( var i = 1 ; i <= 8 ; i ++ ) { var val = 1 ; for ( var j = 1 ; j <= i ; j ++ ) val *= i ; kPowKform . add ( val ) ; } canBeConverted ( N ) ;