1 | initial version |
Hello! I am assuming nPr means "n permutation r". Unfortunately, SageMath doesn't have a command for that purpose. However, if you remember that
$$nPr = \frac{n!}{(n-r)!} = \binom{n}{r}r!,$$
you can make something like this:
perm(n, r) = factorial(n) / factorial(n - r)
or even:
perm(n, r) = binomial(n, r) * factorial(r)
Hope this helps!