Function to check if any permutation of N exist such that it is some power of K
static String anyPermutation ( int N , int K ) { int powK [ ] = new int [ 100 + 1 ] , Limit = ( int ) Math . pow ( 10 , 18 ) ;