All possible numbers of N digits and base B without leading zeros | function to count all permutations ; count of all permutations ; count of permutations with leading zeros ; Return the permutations without leading zeros ; Driver code
function countPermutations ( N , B ) { var x = Math . pow ( B , N ) ; var y = Math . pow ( B , N - 1 ) ; document . write ( x - y ) ; } var N = 6 ; var B = 4 ; countPermutations ( N , B ) ;