Partial gene orderings

Similar species will share many of the same genes, possibly with modifications. Thus, we can compare two genomes by analyzing the orderings of their genes, then inferring which rearrangements have separated the genes.

In "Enumerating gene orders1" we used permutations to model gene orderings. Yet two genomes will have evolved along their own separate paths, and so they won't share all of the same genes. As a result, we should modify the notion of permutation in order to quantify the notion of partial gene orderings.

Assignment

A partial permutation is an ordering of only $$k$$ objects taken from a collection containing $$n$$ objects (i.e., $$k \leq n$$). For example, one partial permutation of three of the first eight positive integers is given by $$(5, 7, 2)$$.

The statistic $$P(n, k)$$ counts the total number of partial permutations of $$k$$ objects that can be formed from a collection of $$n$$ objects. Note that $$P(n, n)$$ is just the number of permutations of $$n$$ objects, which we found to be equal to $$n! = n (n-1) (n-2) \cdots (3) (2)$$ in "Enumerating gene orders2".

Write a function partialPermutations that takes two positive integers $$n$$ and $$k$$, with $$n, k \in \mathbb{N}_0$$. The function must return the total number of partial permutations $$P(n, k)$$.

Example

>>> partialPermutations(21, 7)
586051200
>>> partialPermutations(94, 8)
4488223369069440
>>> partialPermutations(92, 8)
3753021371299200