What is the mathamatical term for this programming concept?

167 Views Asked by At

In python's itertools, there is a function called permutations. It returns the number of ways to arrange x number of variables into a given space.

For example,

permutations("ABC", 2) == [('A', 'B'), ('A', 'C'), ('B', 'A'), ('B', 'C'), ('C', 'A'), ('C', 'B')]

The first argument is the number of variables, and the second is the size of each group.

This concept is similar to factorial, but you don't use every variable in each group.

Side question: Is there a mathematical term for all of the differnt permuation size added up all the way to factorial, e.g, permutations("ABC", 1)+permutations("ABC", 2)+permutations("ABC", 3)

Sorry if this is a silly question. I am just a HS student.

1

There are 1 best solutions below

0
On BEST ANSWER

If $f(n)$ is the sum of k-permutations of n, then \[ f(n)=\sum_{i=1}^{n} \frac{n!}{(n-i)!},\ \mbox{for}\ n\ge1 \]