Function to return the number of ways to arrange K different objects taking N objects at a time
static long countArrangements ( long n , long k , long p ) { return ( factorial ( n , p ) * nCrModP ( k , n , p ) ) % p ; }