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