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