Function to find the number of permutations of n different things taken r at a time with k things grouped together
function countPermutations ( $ n , $ r , $ k ) { return factorial ( $ k ) * ( $ r - $ k + 1 ) * npr ( $ n - $ k , $ r - $ k ) ; }