# permutations() Function & Examples

Use the permutations() probability function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## permutations

#### permutations(n)

#### permutations(n, k)

Try it yourself:

```calculio
permutations(5)
permutations(5, 3)
```

[combinations](https://calcul.io/function/combinations/index.md)

[factorial](https://calcul.io/function/factorial/index.md)

---

## permutations(): count ordered selections

**permutations(n, k)** counts ways to choose and arrange k distinct items from n. Order matters: choosing A then B differs from B then A.

## Formula

The count is `n!/(n-k)!`. For example, choosing first and second place from five entrants produces `permutations(5, 2) = 20`.

## Compare counting methods

Use [combinations()](https://calcul.io/function/combinations/index.md) when order does not matter, and [combinationsWithRep()](https://calcul.io/function/combinationsWithRep/index.md) when repeats are allowed. [factorial()](https://calcul.io/function/factorial/index.md) supplies the underlying formula, while [catalan()](https://calcul.io/function/catalan/index.md) counts a different family of structures.

## Input limits

n and k should be non-negative integers with k no greater than n. Counts grow quickly, so keep exact results when possible.

[All functions](https://calcul.io/functions/index.md)
