Function to check if any permutation of N exist such that it is some power of K
function anyPermutation ( N , K ) { let powK = new Array ( 100 + 1 ) , Limit = ( Math . pow ( 10 , 18 ) ) ; for ( let i = 0 ; i < 101 ; i ++ ) powK [ i ] = 0 ;