# Combinations and Permutations Calculator

*Find out how many different ways to choose items.*

*For an in-depth explanation of the formulas please visit Combinations and Permutations.*

Note: The old Flash version is here.

For an in-depth explanation please visit Combinations and Permutations.

## Power Users!

You can now add "Rules" that will reduce the List:**The "has" rule** which says that certain items must be included (for the entry to be included).

Example: **has 2,a,b,c** means that an entry **must** have at least two of the letters a, b and c.

**The "no" rule** which means that some items from the list must not occur together.

Example: **no 2,a,b,c** means that an entry must **not** have two or more of the letters a, b and c.

**The "pattern" rule** is used to impose some kind of pattern to each entry.

Example: **pattern c,*** means that the letter c must be first (anything else can follow)

Put the rule on its own line:

### Example: the "has" rule

a,b,c,d,e,f,g

has 2,a,b

Combinations of a,b,c,d,e,f,g that have at least 2 of a,b or c

## Rules In Detail

### The "has" Rule

*The word "has" followed by a space and a number. Then a comma and a list of items separated by commas.*

The number says how many (minimum) from the list are needed for that result to be allowed.

### Example has 1,a,b,c

Will allow if there is an **a**, or **b**, or **c**, or **a and b**, or **a and c**, or **b and c**, or all three **a,b and c**.

In other words, it insists there be an a or b or c in the result.

So {a,e,f} is accepted, but {d,e,f} is rejected.

### Example has 2,a,b,c

Will allow if there is an **a and b**, or **a and c**, or **b and c**, or all three **a,b and c**.

In other words, it insists there be at least 2 of a or b or c in the result.

So {a,b,f} is accepted, but {a,e,f} is rejected.

### The "no" Rule

*The word "no" followed by a space and a number. Then a comma and a list of items separated by commas.*

The number says how many (minimum) from the list are needed to be a rejection.

### Example: n=5, r=3, Order=no, Replace=no

Which normally produces:

**{a,b,c} {a,b,d} {a,b,e} {a,c,d} {a,c,e} {a,d,e} {b,c,d} {b,c,e} {b,d,e} {c,d,e}**

But when we add a "no" rule like this:

a,b,c,d,e,f,g

no 2,a,b

We get:

**{a,c,d} {a,c,e} {a,d,e} {b,c,d} {b,c,e} {b,d,e} {c,d,e}**

The entries {a,b,c}, {a,b,d} and {a,b,e} are missing because the rule says we can't have 2 from the list a,b (having an a or b is fine, but not together)

### Example: no 2,a,b,c

Allows only these:

**{a,d,e} {b,d,e} {c,d,e}**

It has rejected any with **a and b**, or **a and c**, or **b and c**, or even all three **a,b and c**.

So {a,d,e) is allowed (only one out of a,b and c is in that)

But {b,c,d} is rejected (it has 2 from the list a,b,c)

### Example: no 3,a,b,c

Allows all of these:

**{a,b,d} {a,b,e} {a,c,d} {a,c,e} {a,d,e} {b,c,d} {b,c,e} {b,d,e} {c,d,e}**

Only {a,b,c} is missing because that is the only one that has 3 from the list a,b,c

### The "pattern" Rule

*The word "pattern" followed by a space and a list of items separated by commas.*

You can include these "special" items:

**?**(question mark) means any item. It is like a "wildcard".*****(an asterisk) means any number of items (0, 1, or more). Like a "super wildcard".

### Example: pattern ?,c,*,f

Means "any item, followed by c, followed by zero or more items, then f"

So {a,c,d,f} is allowed

And {b,c,f,g} is also allowed (there are no items between c and f, which is OK)

But {c,d,e,f} is not, because there is no item before c.

### Example: how many ways can Alex, Betty, Carol and John be lined up, with John after Alex.

Use: n=4, r=4, order=yes, replace=no.

pattern *,Alex,*,John

The result is:

{Alex,Betty,Carol,John} {Alex,Betty,John,Carol} {Alex,Carol,Betty,John} {Alex,Carol,John,Betty} {Alex,John,Betty,Carol} {Alex,John,Carol,Betty} {Betty,Alex,Carol,John} {Betty,Alex,John,Carol} {Betty,Carol,Alex,John} {Carol,Alex,Betty,John} {Carol,Alex,John,Betty} {Carol,Betty,Alex,John}